2014-07-13 01:04:16 +02:00
|
|
|
//// [specializedSignatureAsCallbackParameter1.ts]
|
|
|
|
function x3(a: number, cb: (x: number) => number);
|
|
|
|
function x3(a: string, cb: (x: number) => number);
|
|
|
|
function x3(a: any, cb: (x: number) => number) {
|
|
|
|
cb(a);
|
|
|
|
}
|
|
|
|
// both are errors
|
|
|
|
x3(1, (x: string) => 1);
|
|
|
|
x3(1, (x: 'hm') => 1);
|
|
|
|
|
|
|
|
//// [specializedSignatureAsCallbackParameter1.js]
|
|
|
|
function x3(a, cb) {
|
|
|
|
cb(a);
|
|
|
|
}
|
2014-08-16 00:49:09 +02:00
|
|
|
// both are errors
|
2015-03-26 21:46:35 +01:00
|
|
|
x3(1, function (x) { return 1; });
|
|
|
|
x3(1, function (x) { return 1; });
|