47 lines
1,004 B
Text
47 lines
1,004 B
Text
|
=== tests/cases/compiler/multiCallOverloads.ts ===
|
|||
|
interface ICallback {
|
|||
|
>ICallback : ICallback
|
|||
|
|
|||
|
(x?: string):void;
|
|||
|
>x : string
|
|||
|
}
|
|||
|
|
|||
|
function load(f: ICallback) {}
|
|||
|
>load : (f: ICallback) => void
|
|||
|
>f : ICallback
|
|||
|
>ICallback : ICallback
|
|||
|
|
|||
|
var f1: ICallback = function(z?) {}
|
|||
|
>f1 : ICallback
|
|||
|
>ICallback : ICallback
|
|||
|
>function(z?) {} : (z?: string) => void
|
|||
|
>z : string
|
|||
|
|
|||
|
var f2: ICallback = function(z?) {}
|
|||
|
>f2 : ICallback
|
|||
|
>ICallback : ICallback
|
|||
|
>function(z?) {} : (z?: string) => void
|
|||
|
>z : string
|
|||
|
|
|||
|
load(f1) // ok
|
|||
|
>load(f1) : void
|
|||
|
>load : (f: ICallback) => void
|
|||
|
>f1 : ICallback
|
|||
|
|
|||
|
load(f2) // ok
|
|||
|
>load(f2) : void
|
|||
|
>load : (f: ICallback) => void
|
|||
|
>f2 : ICallback
|
|||
|
|
|||
|
load(function() {}) // this shouldn’t be an error
|
|||
|
>load(function() {}) : void
|
|||
|
>load : (f: ICallback) => void
|
|||
|
>function() {} : () => void
|
|||
|
|
|||
|
load(function(z?) {}) // this shouldn't be an error
|
|||
|
>load(function(z?) {}) : void
|
|||
|
>load : (f: ICallback) => void
|
|||
|
>function(z?) {} : (z?: string) => void
|
|||
|
>z : string
|
|||
|
|