48 lines
954 B
TypeScript
48 lines
954 B
TypeScript
|
// @target: ES5
|
||
|
// There should be no errors in this file
|
||
|
class Derived extends Base {
|
||
|
public static createEmpty(): Derived {
|
||
|
var item = new Derived();
|
||
|
return item;
|
||
|
}
|
||
|
}
|
||
|
class BaseCollection<T extends Base> {
|
||
|
constructor(f: () => T) {
|
||
|
(item: Thing) => { return [item.Components]; };
|
||
|
}
|
||
|
}
|
||
|
class Base {
|
||
|
ownerCollection: BaseCollection<Base>;
|
||
|
}
|
||
|
|
||
|
class Thing {
|
||
|
public get Components(): ComponentCollection<any> { return null }
|
||
|
}
|
||
|
|
||
|
class ComponentCollection<T> {
|
||
|
private static sortComponents(p: Foo) {
|
||
|
return p.prop1;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
class Foo {
|
||
|
public get prop1() {
|
||
|
return new GenericType<string>(this);
|
||
|
}
|
||
|
public populate() {
|
||
|
this.prop2;
|
||
|
}
|
||
|
public get prop2(): BaseCollection<Derived> {
|
||
|
return new BaseCollection<Derived>(Derived.createEmpty);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
class GenericType<T> {
|
||
|
constructor(parent: FooBase) { }
|
||
|
}
|
||
|
|
||
|
class FooBase {
|
||
|
public populate() {
|
||
|
|
||
|
}
|
||
|
}
|