TypeScript/tests/baselines/reference/enumIndexer.types
Mohamed Hegazy a76b4b1f28 Array cleanup (#16223)
* Fix for #13840: Remove map tuple overloads

* Coalesce signatures on array that use this args

* Remove generic signatures

* Add comments to toLocalString

* clean up typed array interfaces
2017-06-04 14:26:18 -07:00

41 lines
1.3 KiB
Plaintext

=== tests/cases/compiler/enumIndexer.ts ===
enum MyEnumType {
>MyEnumType : MyEnumType
foo, bar
>foo : MyEnumType.foo
>bar : MyEnumType.bar
}
var _arr = [{ key: 'foo' }, { key: 'bar' }]
>_arr : { key: string; }[]
>[{ key: 'foo' }, { key: 'bar' }] : { key: string; }[]
>{ key: 'foo' } : { key: string; }
>key : string
>'foo' : "foo"
>{ key: 'bar' } : { key: string; }
>key : string
>'bar' : "bar"
var enumValue = MyEnumType.foo;
>enumValue : MyEnumType
>MyEnumType.foo : MyEnumType.foo
>MyEnumType : typeof MyEnumType
>foo : MyEnumType.foo
var x = _arr.map(o => MyEnumType[o.key] === enumValue); // these are not same type
>x : boolean[]
>_arr.map(o => MyEnumType[o.key] === enumValue) : boolean[]
>_arr.map : <U>(callbackfn: (value: { key: string; }, index: number, array: { key: string; }[]) => U, thisArg?: any) => U[]
>_arr : { key: string; }[]
>map : <U>(callbackfn: (value: { key: string; }, index: number, array: { key: string; }[]) => U, thisArg?: any) => U[]
>o => MyEnumType[o.key] === enumValue : (o: { key: string; }) => boolean
>o : { key: string; }
>MyEnumType[o.key] === enumValue : boolean
>MyEnumType[o.key] : any
>MyEnumType : typeof MyEnumType
>o.key : string
>o : { key: string; }
>key : string
>enumValue : MyEnumType