TypeScript/tests/baselines/reference/complexClassRelationships.types

124 lines
2.7 KiB
Plaintext
Raw Normal View History

2014-08-15 23:33:16 +02:00
=== tests/cases/compiler/complexClassRelationships.ts ===
// There should be no errors in this file
class Derived extends Base {
>Derived : Derived
>Base : Base
2014-08-15 23:33:16 +02:00
public static createEmpty(): Derived {
>createEmpty : () => Derived
>Derived : Derived
2014-08-15 23:33:16 +02:00
var item = new Derived();
>item : Derived
2014-08-15 23:33:16 +02:00
>new Derived() : Derived
>Derived : typeof Derived
2014-08-15 23:33:16 +02:00
return item;
>item : Derived
2014-08-15 23:33:16 +02:00
}
}
class BaseCollection<T extends Base> {
>BaseCollection : BaseCollection<T>
>T : T
>Base : Base
2014-08-15 23:33:16 +02:00
constructor(f: () => T) {
>f : () => T
>T : T
2014-08-15 23:33:16 +02:00
(item: Thing) => { return [item.Components]; };
>(item: Thing) => { return [item.Components]; } : (item: Thing) => ComponentCollection<any>[]
>item : Thing
>Thing : Thing
2014-08-15 23:33:16 +02:00
>[item.Components] : ComponentCollection<any>[]
>item.Components : ComponentCollection<any>
>item : Thing
>Components : ComponentCollection<any>
2014-08-15 23:33:16 +02:00
}
}
class Base {
>Base : Base
2014-08-15 23:33:16 +02:00
ownerCollection: BaseCollection<Base>;
>ownerCollection : BaseCollection<Base>
>BaseCollection : BaseCollection<T>
>Base : Base
2014-08-15 23:33:16 +02:00
}
class Thing {
>Thing : Thing
2014-08-15 23:33:16 +02:00
public get Components(): ComponentCollection<any> { return null }
>Components : ComponentCollection<any>
>ComponentCollection : ComponentCollection<T>
2015-04-13 21:36:11 +02:00
>null : null
2014-08-15 23:33:16 +02:00
}
class ComponentCollection<T> {
>ComponentCollection : ComponentCollection<T>
>T : T
2014-08-15 23:33:16 +02:00
private static sortComponents(p: Foo) {
>sortComponents : (p: Foo) => GenericType<string>
>p : Foo
>Foo : Foo
2014-08-15 23:33:16 +02:00
return p.prop1;
>p.prop1 : GenericType<string>
>p : Foo
>prop1 : GenericType<string>
2014-08-15 23:33:16 +02:00
}
}
class Foo {
>Foo : Foo
2014-08-15 23:33:16 +02:00
public get prop1() {
>prop1 : GenericType<string>
2014-08-15 23:33:16 +02:00
return new GenericType<string>(this);
>new GenericType<string>(this) : GenericType<string>
>GenericType : typeof GenericType
>this : Foo
2014-08-15 23:33:16 +02:00
}
public populate() {
>populate : () => void
2014-08-15 23:33:16 +02:00
this.prop2;
>this.prop2 : BaseCollection<Derived>
>this : Foo
>prop2 : BaseCollection<Derived>
2014-08-15 23:33:16 +02:00
}
public get prop2(): BaseCollection<Derived> {
>prop2 : BaseCollection<Derived>
>BaseCollection : BaseCollection<T>
>Derived : Derived
2014-08-15 23:33:16 +02:00
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
2014-08-15 23:33:16 +02:00
}
}
class GenericType<T> {
>GenericType : GenericType<T>
>T : T
2014-08-15 23:33:16 +02:00
constructor(parent: FooBase) { }
>parent : FooBase
>FooBase : FooBase
2014-08-15 23:33:16 +02:00
}
class FooBase {
>FooBase : FooBase
2014-08-15 23:33:16 +02:00
public populate() {
>populate : () => void
2014-08-15 23:33:16 +02:00
}
}