TypeScript/tests/baselines/reference/genericWithIndexerOfTypeParameterType1.types

36 lines
1 KiB
Plaintext
Raw Normal View History

2014-08-15 23:33:16 +02:00
=== tests/cases/compiler/genericWithIndexerOfTypeParameterType1.ts ===
class LazyArray<T> {
>LazyArray : LazyArray<T>
>T : T
2014-08-15 23:33:16 +02:00
private objects = <{ [objectId: string]: T; }>{};
>objects : { [objectId: string]: T; }
><{ [objectId: string]: T; }>{} : { [objectId: string]: T; }
>objectId : string
>T : T
2014-10-13 15:56:58 +02:00
>{} : { [x: string]: undefined; }
2014-08-15 23:33:16 +02:00
array() {
>array : () => { [objectId: string]: T; }
2014-08-15 23:33:16 +02:00
return this.objects;
>this.objects : { [objectId: string]: T; }
>this : LazyArray<T>
>objects : { [objectId: string]: T; }
2014-08-15 23:33:16 +02:00
}
}
var lazyArray = new LazyArray<string>();
>lazyArray : LazyArray<string>
2014-08-15 23:33:16 +02:00
>new LazyArray<string>() : LazyArray<string>
>LazyArray : typeof LazyArray
2014-08-15 23:33:16 +02:00
var value: string = lazyArray.array()["test"]; // used to be an error
>value : string
2014-08-15 23:33:16 +02:00
>lazyArray.array()["test"] : string
>lazyArray.array() : { [objectId: string]: string; }
>lazyArray.array : () => { [objectId: string]: string; }
>lazyArray : LazyArray<string>
>array : () => { [objectId: string]: string; }
2015-04-13 21:36:11 +02:00
>"test" : string
2014-08-15 23:33:16 +02:00