2014-08-15 23:33:16 +02:00
|
|
|
=== tests/cases/compiler/genericWithIndexerOfTypeParameterType1.ts ===
|
|
|
|
class LazyArray<T> {
|
|
|
|
>LazyArray : LazyArray<T>
|
|
|
|
>T : T
|
|
|
|
|
|
|
|
private objects = <{ [objectId: string]: T; }>{};
|
2014-12-06 01:58:49 +01:00
|
|
|
>objects : { [objectId: string]: T; }
|
|
|
|
><{ [objectId: string]: T; }>{} : { [objectId: string]: T; }
|
2014-08-15 23:33:16 +02:00
|
|
|
>objectId : string
|
|
|
|
>T : T
|
2014-10-13 15:56:58 +02:00
|
|
|
>{} : { [x: string]: undefined; }
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
array() {
|
2014-12-06 01:58:49 +01:00
|
|
|
>array : () => { [objectId: string]: T; }
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
return this.objects;
|
2014-12-06 01:58:49 +01:00
|
|
|
>this.objects : { [objectId: string]: T; }
|
2014-08-15 23:33:16 +02:00
|
|
|
>this : LazyArray<T>
|
2014-12-06 01:58:49 +01:00
|
|
|
>objects : { [objectId: string]: T; }
|
2014-08-15 23:33:16 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
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
|
2014-12-06 01:58:49 +01:00
|
|
|
>lazyArray.array() : { [objectId: string]: string; }
|
|
|
|
>lazyArray.array : () => { [objectId: string]: string; }
|
2014-08-15 23:33:16 +02:00
|
|
|
>lazyArray : LazyArray<string>
|
2014-12-06 01:58:49 +01:00
|
|
|
>array : () => { [objectId: string]: string; }
|
2014-08-15 23:33:16 +02:00
|
|
|
|