2014-08-15 23:33:16 +02:00
|
|
|
=== tests/cases/compiler/genericTypeArgumentInference1.ts ===
|
|
|
|
module Underscore {
|
2014-08-28 21:40:58 +02:00
|
|
|
>Underscore : unknown
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
export interface Iterator<T, U> {
|
|
|
|
>Iterator : Iterator<T, U>
|
|
|
|
>T : T
|
|
|
|
>U : U
|
|
|
|
|
|
|
|
(value: T, index: any, list: any): U;
|
|
|
|
>value : T
|
|
|
|
>T : T
|
|
|
|
>index : any
|
|
|
|
>list : any
|
|
|
|
>U : U
|
|
|
|
}
|
|
|
|
export interface Static {
|
|
|
|
>Static : Static
|
|
|
|
|
|
|
|
all<T>(list: T[], iterator?: Iterator<T, boolean>, context?: any): T;
|
|
|
|
>all : <T>(list: T[], iterator?: Iterator<T, boolean>, context?: any) => T
|
|
|
|
>T : T
|
|
|
|
>list : T[]
|
|
|
|
>T : T
|
|
|
|
>iterator : Iterator<T, boolean>
|
2014-08-19 04:56:03 +02:00
|
|
|
>Iterator : Iterator<T, U>
|
2014-08-15 23:33:16 +02:00
|
|
|
>T : T
|
|
|
|
>context : any
|
|
|
|
>T : T
|
|
|
|
|
|
|
|
identity<T>(value: T): T;
|
|
|
|
>identity : <T>(value: T) => T
|
|
|
|
>T : T
|
|
|
|
>value : T
|
|
|
|
>T : T
|
|
|
|
>T : T
|
|
|
|
}
|
|
|
|
}
|
|
|
|
declare var _: Underscore.Static;
|
2014-08-25 19:36:12 +02:00
|
|
|
>_ : Underscore.Static
|
2014-08-28 21:40:58 +02:00
|
|
|
>Underscore : unknown
|
2014-08-25 19:36:12 +02:00
|
|
|
>Static : Underscore.Static
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
var r = _.all([true, 1, null, 'yes'], _.identity);
|
2014-10-08 22:48:44 +02:00
|
|
|
>r : string | number | boolean
|
|
|
|
>_.all([true, 1, null, 'yes'], _.identity) : string | number | boolean
|
2014-08-25 19:36:12 +02:00
|
|
|
>_.all : <T>(list: T[], iterator?: Underscore.Iterator<T, boolean>, context?: any) => T
|
|
|
|
>_ : Underscore.Static
|
|
|
|
>all : <T>(list: T[], iterator?: Underscore.Iterator<T, boolean>, context?: any) => T
|
2014-10-18 01:53:18 +02:00
|
|
|
>[true, 1, null, 'yes'] : (string | number | boolean)[]
|
2014-08-15 23:33:16 +02:00
|
|
|
>_.identity : <T>(value: T) => T
|
2014-08-25 19:36:12 +02:00
|
|
|
>_ : Underscore.Static
|
2014-08-15 23:33:16 +02:00
|
|
|
>identity : <T>(value: T) => T
|
|
|
|
|
|
|
|
var r2 = _.all([true], _.identity);
|
|
|
|
>r2 : boolean
|
|
|
|
>_.all([true], _.identity) : boolean
|
2014-08-25 19:36:12 +02:00
|
|
|
>_.all : <T>(list: T[], iterator?: Underscore.Iterator<T, boolean>, context?: any) => T
|
|
|
|
>_ : Underscore.Static
|
|
|
|
>all : <T>(list: T[], iterator?: Underscore.Iterator<T, boolean>, context?: any) => T
|
2014-08-15 23:33:16 +02:00
|
|
|
>[true] : boolean[]
|
|
|
|
>_.identity : <T>(value: T) => T
|
2014-08-25 19:36:12 +02:00
|
|
|
>_ : Underscore.Static
|
2014-08-15 23:33:16 +02:00
|
|
|
>identity : <T>(value: T) => T
|
|
|
|
|
|
|
|
var r3 = _.all([], _.identity);
|
|
|
|
>r3 : any
|
|
|
|
>_.all([], _.identity) : any
|
2014-08-25 19:36:12 +02:00
|
|
|
>_.all : <T>(list: T[], iterator?: Underscore.Iterator<T, boolean>, context?: any) => T
|
|
|
|
>_ : Underscore.Static
|
|
|
|
>all : <T>(list: T[], iterator?: Underscore.Iterator<T, boolean>, context?: any) => T
|
2014-10-13 15:56:58 +02:00
|
|
|
>[] : undefined[]
|
2014-08-15 23:33:16 +02:00
|
|
|
>_.identity : <T>(value: T) => T
|
2014-08-25 19:36:12 +02:00
|
|
|
>_ : Underscore.Static
|
2014-08-15 23:33:16 +02:00
|
|
|
>identity : <T>(value: T) => T
|
|
|
|
|
|
|
|
var r4 = _.all([<any>true], _.identity);
|
|
|
|
>r4 : any
|
|
|
|
>_.all([<any>true], _.identity) : any
|
2014-08-25 19:36:12 +02:00
|
|
|
>_.all : <T>(list: T[], iterator?: Underscore.Iterator<T, boolean>, context?: any) => T
|
|
|
|
>_ : Underscore.Static
|
|
|
|
>all : <T>(list: T[], iterator?: Underscore.Iterator<T, boolean>, context?: any) => T
|
2014-08-15 23:33:16 +02:00
|
|
|
>[<any>true] : any[]
|
|
|
|
><any>true : any
|
|
|
|
>_.identity : <T>(value: T) => T
|
2014-08-25 19:36:12 +02:00
|
|
|
>_ : Underscore.Static
|
2014-08-15 23:33:16 +02:00
|
|
|
>identity : <T>(value: T) => T
|
|
|
|
|