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 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108
|
=== tests/cases/compiler/complexClassRelationships.ts ===
// There should be no errors in this file
class Derived extends Base {
>Derived : Derived
>Base : Base
public static createEmpty(): Derived {
>createEmpty : () => Derived
var item = new Derived();
>item : Derived
>new Derived() : Derived
>Derived : typeof Derived
return item;
>item : Derived
}
}
class BaseCollection<T extends Base> {
>BaseCollection : BaseCollection<T>
constructor(f: () => T) {
>f : () => T
(item: Thing) => { return [item.Components]; };
>(item: Thing) => { return [item.Components]; } : (item: Thing) => ComponentCollection<any>[]
>item : Thing
>[item.Components] : ComponentCollection<any>[]
>item.Components : ComponentCollection<any>
>item : Thing
>Components : ComponentCollection<any>
}
}
class Base {
>Base : Base
ownerCollection: BaseCollection<Base>;
>ownerCollection : BaseCollection<Base>
}
class Thing {
>Thing : Thing
public get Components(): ComponentCollection<any> { return null }
>Components : ComponentCollection<any>
>null : null
}
class ComponentCollection<T> {
>ComponentCollection : ComponentCollection<T>
private static sortComponents(p: Foo) {
>sortComponents : (p: Foo) => GenericType<string>
>p : Foo
return p.prop1;
>p.prop1 : GenericType<string>
>p : Foo
>prop1 : GenericType<string>
}
}
class Foo {
>Foo : Foo
public get prop1() {
>prop1 : GenericType<string>
return new GenericType<string>(this);
>new GenericType<string>(this) : GenericType<string>
>GenericType : typeof GenericType
>this : this
}
public populate() {
>populate : () => void
this.prop2;
>this.prop2 : BaseCollection<Derived>
>this : this
>prop2 : BaseCollection<Derived>
}
public get prop2(): BaseCollection<Derived> {
>prop2 : BaseCollection<Derived>
return new BaseCollection<Derived>(Derived.createEmpty);
>new BaseCollection<Derived>(Derived.createEmpty) : BaseCollection<Derived>
>BaseCollection : typeof BaseCollection
>Derived.createEmpty : () => Derived
>Derived : typeof Derived
>createEmpty : () => Derived
}
}
class GenericType<T> {
>GenericType : GenericType<T>
constructor(parent: FooBase) { }
>parent : FooBase
}
class FooBase {
>FooBase : FooBase
public populate() {
>populate : () => void
}
}
|