TypeScript/tests/baselines/reference/multiCallOverloads.js

24 lines
573 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//// [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 shouldnt be an error
load(function(z?) {}) // this shouldn't be an error
//// [multiCallOverloads.js]
function load(f) { }
var f1 = function (z) { };
var f2 = function (z) { };
load(f1); // ok
load(f2); // ok
load(function () { }); // this shouldnt be an error
load(function (z) { }); // this shouldn't be an error