46 lines
No EOL
1.9 KiB
Text
46 lines
No EOL
1.9 KiB
Text
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'.
|
|
|