55 lines
1.8 KiB
Text
55 lines
1.8 KiB
Text
|
==== tests/cases/conformance/expressions/functionCalls/functionCalls.ts (9 errors) ====
|
||
|
|
||
|
// Invoke function call on value of type 'any' with no type arguments
|
||
|
var anyVar: any;
|
||
|
anyVar(0);
|
||
|
anyVar('');
|
||
|
|
||
|
// Invoke function call on value of type 'any' with type arguments
|
||
|
// These should be errors
|
||
|
anyVar<string>('hello');
|
||
|
~~~~~~~~~~~~~~~~~~~~~~~
|
||
|
!!! Untyped function calls may not accept type arguments.
|
||
|
anyVar<number>();
|
||
|
~~~~~~~~~~~~~~~~
|
||
|
!!! Untyped function calls may not accept type arguments.
|
||
|
anyVar<Window>(undefined);
|
||
|
~~~~~~~~~~~~~~~~~~~~~~~~~
|
||
|
!!! Untyped function calls may not accept type arguments.
|
||
|
|
||
|
|
||
|
// Invoke function call on value of a subtype of Function with no call signatures with no type arguments
|
||
|
interface SubFunc extends Function {
|
||
|
prop: number;
|
||
|
}
|
||
|
var subFunc: SubFunc;
|
||
|
subFunc(0);
|
||
|
subFunc('');
|
||
|
subFunc();
|
||
|
|
||
|
|
||
|
// Invoke function call on value of a subtype of Function with no call signatures with type arguments
|
||
|
// These should be errors
|
||
|
subFunc<number>(0);
|
||
|
~~~~~~~~~~~~~~~~~~
|
||
|
!!! Untyped function calls may not accept type arguments.
|
||
|
subFunc<string>('');
|
||
|
~~~~~~~~~~~~~~~~~~~
|
||
|
!!! Untyped function calls may not accept type arguments.
|
||
|
subFunc<any>();
|
||
|
~~~~~~~~~~~~~~
|
||
|
!!! Untyped function calls may not accept type arguments.
|
||
|
|
||
|
// Invoke function call on value of type Function with no call signatures with type arguments
|
||
|
// These should be errors
|
||
|
var func: Function;
|
||
|
func<number>(0);
|
||
|
~~~~~~~~~~~~~~~
|
||
|
!!! Untyped function calls may not accept type arguments.
|
||
|
func<string>('');
|
||
|
~~~~~~~~~~~~~~~~
|
||
|
!!! Untyped function calls may not accept type arguments.
|
||
|
func<any>();
|
||
|
~~~~~~~~~~~
|
||
|
!!! Untyped function calls may not accept type arguments.
|
||
|
|