2014-08-15 23:33:16 +02:00
|
|
|
=== tests/cases/compiler/objectLiteralArraySpecialization.ts ===
|
|
|
|
declare function create<T>(initialValues?: T[]): MyArrayWrapper<T>;
|
|
|
|
>create : <T>(initialValues?: T[]) => MyArrayWrapper<T>
|
|
|
|
>T : T
|
|
|
|
>initialValues : T[]
|
|
|
|
>T : T
|
2014-08-19 04:56:03 +02:00
|
|
|
>MyArrayWrapper : MyArrayWrapper<T>
|
2014-08-15 23:33:16 +02:00
|
|
|
>T : T
|
|
|
|
|
|
|
|
interface MyArrayWrapper<T> {
|
|
|
|
>MyArrayWrapper : MyArrayWrapper<T>
|
|
|
|
>T : T
|
|
|
|
|
|
|
|
constructor(initialItems?: T[]);
|
|
|
|
>constructor : (initialItems?: T[]) => any
|
|
|
|
>initialItems : T[]
|
|
|
|
>T : T
|
|
|
|
|
|
|
|
doSomething(predicate: (x: T, y: T) => boolean): void;
|
|
|
|
>doSomething : (predicate: (x: T, y: T) => boolean) => void
|
|
|
|
>predicate : (x: T, y: T) => boolean
|
|
|
|
>x : T
|
|
|
|
>T : T
|
|
|
|
>y : T
|
|
|
|
>T : T
|
|
|
|
}
|
|
|
|
var thing = create([ { name: "bob", id: 24 }, { name: "doug", id: 32 } ]); // should not error
|
|
|
|
>thing : MyArrayWrapper<{ name: string; id: number; }>
|
|
|
|
>create([ { name: "bob", id: 24 }, { name: "doug", id: 32 } ]) : MyArrayWrapper<{ name: string; id: number; }>
|
|
|
|
>create : <T>(initialValues?: T[]) => MyArrayWrapper<T>
|
|
|
|
>[ { name: "bob", id: 24 }, { name: "doug", id: 32 } ] : { name: string; id: number; }[]
|
|
|
|
>{ name: "bob", id: 24 } : { name: string; id: number; }
|
|
|
|
>name : string
|
|
|
|
>id : number
|
|
|
|
>{ name: "doug", id: 32 } : { name: string; id: number; }
|
|
|
|
>name : string
|
|
|
|
>id : number
|
|
|
|
|
|
|
|
thing.doSomething((x, y) => x.name === "bob"); // should not error
|
|
|
|
>thing.doSomething((x, y) => x.name === "bob") : void
|
|
|
|
>thing.doSomething : (predicate: (x: { name: string; id: number; }, y: { name: string; id: number; }) => boolean) => void
|
|
|
|
>thing : MyArrayWrapper<{ name: string; id: number; }>
|
|
|
|
>doSomething : (predicate: (x: { name: string; id: number; }, y: { name: string; id: number; }) => boolean) => void
|
|
|
|
>(x, y) => x.name === "bob" : (x: { name: string; id: number; }, y: { name: string; id: number; }) => boolean
|
|
|
|
>x : { name: string; id: number; }
|
|
|
|
>y : { name: string; id: number; }
|
|
|
|
>x.name === "bob" : boolean
|
|
|
|
>x.name : string
|
|
|
|
>x : { name: string; id: number; }
|
|
|
|
>name : string
|
|
|
|
|