mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
76 lines
2.6 KiB
Plaintext
76 lines
2.6 KiB
Plaintext
//// [tests/cases/conformance/expressions/functionCalls/functionCalls.ts] ////
|
|
|
|
=== functionCalls.ts ===
|
|
// Invoke function call on value of type 'any' with no type arguments
|
|
declare var anyVar: any;
|
|
>anyVar : Symbol(anyVar, Decl(functionCalls.ts, 1, 11))
|
|
|
|
anyVar(0);
|
|
>anyVar : Symbol(anyVar, Decl(functionCalls.ts, 1, 11))
|
|
|
|
anyVar('');
|
|
>anyVar : Symbol(anyVar, Decl(functionCalls.ts, 1, 11))
|
|
|
|
// Invoke function call on value of type 'any' with type arguments
|
|
// These should be errors
|
|
anyVar<string>('hello');
|
|
>anyVar : Symbol(anyVar, Decl(functionCalls.ts, 1, 11))
|
|
|
|
anyVar<number>();
|
|
>anyVar : Symbol(anyVar, Decl(functionCalls.ts, 1, 11))
|
|
|
|
anyVar<Window>(undefined);
|
|
>anyVar : Symbol(anyVar, Decl(functionCalls.ts, 1, 11))
|
|
>Window : Symbol(Window, Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --))
|
|
>undefined : Symbol(undefined)
|
|
|
|
|
|
// Invoke function call on value of a subtype of Function with no call signatures with no type arguments
|
|
interface SubFunc extends Function {
|
|
>SubFunc : Symbol(SubFunc, Decl(functionCalls.ts, 9, 26))
|
|
>Function : Symbol(Function, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --))
|
|
|
|
prop: number;
|
|
>prop : Symbol(SubFunc.prop, Decl(functionCalls.ts, 13, 36))
|
|
}
|
|
declare var subFunc: SubFunc;
|
|
>subFunc : Symbol(subFunc, Decl(functionCalls.ts, 16, 11))
|
|
>SubFunc : Symbol(SubFunc, Decl(functionCalls.ts, 9, 26))
|
|
|
|
subFunc(0);
|
|
>subFunc : Symbol(subFunc, Decl(functionCalls.ts, 16, 11))
|
|
|
|
subFunc('');
|
|
>subFunc : Symbol(subFunc, Decl(functionCalls.ts, 16, 11))
|
|
|
|
subFunc();
|
|
>subFunc : Symbol(subFunc, Decl(functionCalls.ts, 16, 11))
|
|
|
|
|
|
// Invoke function call on value of a subtype of Function with no call signatures with type arguments
|
|
// These should be errors
|
|
subFunc<number>(0);
|
|
>subFunc : Symbol(subFunc, Decl(functionCalls.ts, 16, 11))
|
|
|
|
subFunc<string>('');
|
|
>subFunc : Symbol(subFunc, Decl(functionCalls.ts, 16, 11))
|
|
|
|
subFunc<any>();
|
|
>subFunc : Symbol(subFunc, Decl(functionCalls.ts, 16, 11))
|
|
|
|
// Invoke function call on value of type Function with no call signatures with type arguments
|
|
// These should be errors
|
|
declare var func: Function;
|
|
>func : Symbol(func, Decl(functionCalls.ts, 30, 11))
|
|
>Function : Symbol(Function, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --))
|
|
|
|
func<number>(0);
|
|
>func : Symbol(func, Decl(functionCalls.ts, 30, 11))
|
|
|
|
func<string>('');
|
|
>func : Symbol(func, Decl(functionCalls.ts, 30, 11))
|
|
|
|
func<any>();
|
|
>func : Symbol(func, Decl(functionCalls.ts, 30, 11))
|
|
|