2014-07-13 01:04:16 +02:00
|
|
|
//// [genericCallWithFunctionTypedArguments3.ts]
|
|
|
|
// No inference is made from function typed arguments which have multiple call signatures
|
|
|
|
|
|
|
|
var a: {
|
|
|
|
(x: boolean): boolean;
|
|
|
|
(x: string): any;
|
|
|
|
}
|
|
|
|
|
|
|
|
function foo4<T, U>(cb: (x: T) => U) {
|
|
|
|
var u: U;
|
|
|
|
return u;
|
|
|
|
}
|
|
|
|
|
|
|
|
var r = foo4(a); // T is {} (candidates boolean and string), U is any (candidates any and boolean)
|
|
|
|
|
|
|
|
var b: {
|
|
|
|
<T>(x: boolean): T;
|
|
|
|
<T>(x: T): any;
|
|
|
|
}
|
|
|
|
|
|
|
|
var r2 = foo4(b); // T is {} (candidates boolean and {}), U is any (candidates any and {})
|
|
|
|
|
|
|
|
//// [genericCallWithFunctionTypedArguments3.js]
|
2014-08-12 00:54:12 +02:00
|
|
|
// No inference is made from function typed arguments which have multiple call signatures
|
2014-07-13 01:04:16 +02:00
|
|
|
var a;
|
|
|
|
function foo4(cb) {
|
|
|
|
var u;
|
|
|
|
return u;
|
|
|
|
}
|
2014-08-15 01:36:33 +02:00
|
|
|
var r = foo4(a); // T is {} (candidates boolean and string), U is any (candidates any and boolean)
|
2014-07-13 01:04:16 +02:00
|
|
|
var b;
|
2014-08-15 01:36:33 +02:00
|
|
|
var r2 = foo4(b); // T is {} (candidates boolean and {}), U is any (candidates any and {})
|