File: unionTypeWithRecursiveSubtypeReduction2.errors.txt

package info (click to toggle)
node-typescript 2.1.5-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 203,952 kB
  • ctags: 52,987
  • sloc: sh: 11; makefile: 5
file content (46 lines) | stat: -rw-r--r-- 1,945 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
tests/cases/compiler/unionTypeWithRecursiveSubtypeReduction2.ts(19,1): error TS2322: Type 'Property' is not assignable to type 'Class'.
  Types of property 'parent' are incompatible.
    Type 'Module | Class' is not assignable to type 'Namespace'.
      Type 'Class' is not assignable to type 'Namespace'.
        Property 'members' is missing in type 'Class'.
tests/cases/compiler/unionTypeWithRecursiveSubtypeReduction2.ts(20,1): error TS2322: Type 'Class' is not assignable to type 'Property'.
  Types of property 'parent' are incompatible.
    Type 'Namespace' is not assignable to type 'Module | Class'.
      Type 'Namespace' is not assignable to type 'Class'.
        Property 'parent' is missing in type 'Namespace'.


==== tests/cases/compiler/unionTypeWithRecursiveSubtypeReduction2.ts (2 errors) ====
    class Module {
        public members: Class[];
    }
    
    class Namespace {
        public members: (Class | Property)[];
    }
    
    class Class {
        public parent: Namespace;
    }
    
    class Property {
        public parent: Module | Class;
    }
    
    var c: Class;
    var p: Property;
    c = p;
    ~
!!! error TS2322: Type 'Property' is not assignable to type 'Class'.
!!! error TS2322:   Types of property 'parent' are incompatible.
!!! error TS2322:     Type 'Module | Class' is not assignable to type 'Namespace'.
!!! error TS2322:       Type 'Class' is not assignable to type 'Namespace'.
!!! error TS2322:         Property 'members' is missing in type 'Class'.
    p = c;
    ~
!!! error TS2322: Type 'Class' is not assignable to type 'Property'.
!!! error TS2322:   Types of property 'parent' are incompatible.
!!! error TS2322:     Type 'Namespace' is not assignable to type 'Module | Class'.
!!! error TS2322:       Type 'Namespace' is not assignable to type 'Class'.
!!! error TS2322:         Property 'parent' is missing in type 'Namespace'.