2014-07-13 01:04:16 +02:00
|
|
|
|
//// [multiCallOverloads.ts]
|
|
|
|
|
interface ICallback {
|
|
|
|
|
(x?: string):void;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function load(f: ICallback) {}
|
|
|
|
|
|
|
|
|
|
var f1: ICallback = function(z?) {}
|
|
|
|
|
var f2: ICallback = function(z?) {}
|
|
|
|
|
load(f1) // ok
|
|
|
|
|
load(f2) // ok
|
|
|
|
|
load(function() {}) // this shouldn’t be an error
|
|
|
|
|
load(function(z?) {}) // this shouldn't be an error
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//// [multiCallOverloads.js]
|
2015-03-09 02:23:23 +01:00
|
|
|
|
function load(f) {
|
|
|
|
|
}
|
|
|
|
|
var f1 = function (z) {
|
|
|
|
|
};
|
|
|
|
|
var f2 = function (z) {
|
|
|
|
|
};
|
2014-08-16 00:49:09 +02:00
|
|
|
|
load(f1); // ok
|
|
|
|
|
load(f2); // ok
|
2015-03-09 02:23:23 +01:00
|
|
|
|
load(function () {
|
|
|
|
|
}); // this shouldn’t be an error
|
|
|
|
|
load(function (z) {
|
|
|
|
|
}); // this shouldn't be an error
|