2014-08-15 23:33:16 +02:00
|
|
|
=== tests/cases/compiler/genericArgumentCallSigAssignmentCompat.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): boolean;
|
|
|
|
>all : <T>(list: T[], iterator?: Iterator<T, boolean>, context?: any) => boolean
|
|
|
|
>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
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
// No error, Call signatures of types '<T>(value: T) => T' and 'Underscore.Iterator<{}, boolean>' are compatible when instantiated with any.
|
|
|
|
// Ideally, we would not have a generic signature here, because it should be instantiated with {} during inferential typing
|
|
|
|
_.all([true, 1, null, 'yes'], _.identity);
|
|
|
|
>_.all([true, 1, null, 'yes'], _.identity) : boolean
|
2014-08-25 19:36:12 +02:00
|
|
|
>_.all : <T>(list: T[], iterator?: Underscore.Iterator<T, boolean>, context?: any) => boolean
|
|
|
|
>_ : Underscore.Static
|
|
|
|
>all : <T>(list: T[], iterator?: Underscore.Iterator<T, boolean>, context?: any) => boolean
|
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
|
|
|
|
|
|
|
|
// Ok, because fixing makes us infer boolean for T
|
|
|
|
_.all([true], _.identity);
|
|
|
|
>_.all([true], _.identity) : boolean
|
2014-08-25 19:36:12 +02:00
|
|
|
>_.all : <T>(list: T[], iterator?: Underscore.Iterator<T, boolean>, context?: any) => boolean
|
|
|
|
>_ : Underscore.Static
|
|
|
|
>all : <T>(list: T[], iterator?: Underscore.Iterator<T, boolean>, context?: any) => boolean
|
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
|
|
|
|
|