123 lines
2.7 KiB
Text
123 lines
2.7 KiB
Text
=== 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
|
|
>Derived : 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>
|
|
>T : T
|
|
>Base : Base
|
|
|
|
constructor(f: () => T) {
|
|
>f : () => T
|
|
>T : T
|
|
|
|
(item: Thing) => { return [item.Components]; };
|
|
>(item: Thing) => { return [item.Components]; } : (item: Thing) => ComponentCollection<any>[]
|
|
>item : Thing
|
|
>Thing : Thing
|
|
>[item.Components] : ComponentCollection<any>[]
|
|
>item.Components : ComponentCollection<any>
|
|
>item : Thing
|
|
>Components : ComponentCollection<any>
|
|
}
|
|
}
|
|
class Base {
|
|
>Base : Base
|
|
|
|
ownerCollection: BaseCollection<Base>;
|
|
>ownerCollection : BaseCollection<Base>
|
|
>BaseCollection : BaseCollection<T>
|
|
>Base : Base
|
|
}
|
|
|
|
class Thing {
|
|
>Thing : Thing
|
|
|
|
public get Components(): ComponentCollection<any> { return null }
|
|
>Components : ComponentCollection<any>
|
|
>ComponentCollection : ComponentCollection<T>
|
|
>null : null
|
|
}
|
|
|
|
class ComponentCollection<T> {
|
|
>ComponentCollection : ComponentCollection<T>
|
|
>T : T
|
|
|
|
private static sortComponents(p: Foo) {
|
|
>sortComponents : (p: Foo) => GenericType<string>
|
|
>p : Foo
|
|
>Foo : 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 : Foo
|
|
}
|
|
public populate() {
|
|
>populate : () => void
|
|
|
|
this.prop2;
|
|
>this.prop2 : BaseCollection<Derived>
|
|
>this : Foo
|
|
>prop2 : BaseCollection<Derived>
|
|
}
|
|
public get prop2(): BaseCollection<Derived> {
|
|
>prop2 : BaseCollection<Derived>
|
|
>BaseCollection : BaseCollection<T>
|
|
>Derived : Derived
|
|
|
|
return new BaseCollection<Derived>(Derived.createEmpty);
|
|
>new BaseCollection<Derived>(Derived.createEmpty) : BaseCollection<Derived>
|
|
>BaseCollection : typeof BaseCollection
|
|
>Derived : Derived
|
|
>Derived.createEmpty : () => Derived
|
|
>Derived : typeof Derived
|
|
>createEmpty : () => Derived
|
|
}
|
|
}
|
|
|
|
class GenericType<T> {
|
|
>GenericType : GenericType<T>
|
|
>T : T
|
|
|
|
constructor(parent: FooBase) { }
|
|
>parent : FooBase
|
|
>FooBase : FooBase
|
|
}
|
|
|
|
class FooBase {
|
|
>FooBase : FooBase
|
|
|
|
public populate() {
|
|
>populate : () => void
|
|
|
|
}
|
|
}
|