TypeScript/tests/cases/compiler/genericTypeArgumentInference1.ts

16 lines
470 B
TypeScript
Raw Normal View History

2014-07-13 01:04:16 +02:00
module Underscore {
export interface Iterator<T, U> {
(value: T, index: any, list: any): U;
}
export interface Static {
all<T>(list: T[], iterator?: Iterator<T, boolean>, context?: any): T;
identity<T>(value: T): T;
}
}
declare var _: Underscore.Static;
var r = _.all([true, 1, null, 'yes'], _.identity);
var r2 = _.all([true], _.identity);
var r3 = _.all([], _.identity);
var r4 = _.all([<any>true], _.identity);