68 lines
2 KiB
Plaintext
68 lines
2 KiB
Plaintext
=== tests/cases/compiler/genericArgumentCallSigAssignmentCompat.ts ===
|
|
module Underscore {
|
|
>Underscore : unknown
|
|
|
|
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>
|
|
>Iterator : Iterator<T, U>
|
|
>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;
|
|
>_ : Underscore.Static
|
|
>Underscore : unknown
|
|
>Static : Underscore.Static
|
|
|
|
// 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
|
|
>_.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
|
|
>[true, 1, null, 'yes'] : (string | number | boolean)[]
|
|
>_.identity : <T>(value: T) => T
|
|
>_ : Underscore.Static
|
|
>identity : <T>(value: T) => T
|
|
|
|
// Ok, because fixing makes us infer boolean for T
|
|
_.all([true], _.identity);
|
|
>_.all([true], _.identity) : boolean
|
|
>_.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
|
|
>[true] : boolean[]
|
|
>_.identity : <T>(value: T) => T
|
|
>_ : Underscore.Static
|
|
>identity : <T>(value: T) => T
|
|
|