TypeScript/tests/baselines/reference/genericWithIndexerOfTypeParameterType1.types
2015-04-15 16:44:20 -07:00

36 lines
1 KiB
Plaintext

=== tests/cases/compiler/genericWithIndexerOfTypeParameterType1.ts ===
class LazyArray<T> {
>LazyArray : LazyArray<T>
>T : T
private objects = <{ [objectId: string]: T; }>{};
>objects : { [objectId: string]: T; }
><{ [objectId: string]: T; }>{} : { [objectId: string]: T; }
>objectId : string
>T : T
>{} : { [x: string]: undefined; }
array() {
>array : () => { [objectId: string]: T; }
return this.objects;
>this.objects : { [objectId: string]: T; }
>this : LazyArray<T>
>objects : { [objectId: string]: T; }
}
}
var lazyArray = new LazyArray<string>();
>lazyArray : LazyArray<string>
>new LazyArray<string>() : LazyArray<string>
>LazyArray : typeof LazyArray
var value: string = lazyArray.array()["test"]; // used to be an error
>value : string
>lazyArray.array()["test"] : string
>lazyArray.array() : { [objectId: string]: string; }
>lazyArray.array : () => { [objectId: string]: string; }
>lazyArray : LazyArray<string>
>array : () => { [objectId: string]: string; }
>"test" : string