2014-07-13 01:04:16 +02:00
|
|
|
//// [objectLiteralArraySpecialization.ts]
|
|
|
|
declare function create<T>(initialValues?: T[]): MyArrayWrapper<T>;
|
|
|
|
interface MyArrayWrapper<T> {
|
|
|
|
constructor(initialItems?: T[]);
|
|
|
|
doSomething(predicate: (x: T, y: T) => boolean): void;
|
|
|
|
}
|
|
|
|
var thing = create([ { name: "bob", id: 24 }, { name: "doug", id: 32 } ]); // should not error
|
|
|
|
thing.doSomething((x, y) => x.name === "bob"); // should not error
|
|
|
|
|
|
|
|
|
|
|
|
//// [objectLiteralArraySpecialization.js]
|
2014-08-15 22:18:54 +02:00
|
|
|
var thing = create([{ name: "bob", id: 24 }, { name: "doug", id: 32 }]); // should not error
|
2014-08-16 00:49:09 +02:00
|
|
|
thing.doSomething(function (x, y) { return x.name === "bob"; }); // should not error
|