28 lines
1.1 KiB
Text
28 lines
1.1 KiB
Text
|
==== tests/cases/compiler/implicitAnyDeclareFunctionWithoutFormalType.ts (8 errors) ====
|
||
|
// these should be errors
|
||
|
function foo(x) { };
|
||
|
~
|
||
|
!!! Parameter 'x' implicitly has an 'any' type.
|
||
|
function bar(x: number, y) { }; // error at "y"; no error at "x"
|
||
|
~
|
||
|
!!! Parameter 'y' implicitly has an 'any' type.
|
||
|
function func2(a, b, c) { }; // error at "a,b,c"
|
||
|
~
|
||
|
!!! Parameter 'a' implicitly has an 'any' type.
|
||
|
~
|
||
|
!!! Parameter 'b' implicitly has an 'any' type.
|
||
|
~
|
||
|
!!! Parameter 'c' implicitly has an 'any' type.
|
||
|
function func3(...args) { }; // error at "args"
|
||
|
~~~~~~~
|
||
|
!!! Rest parameter 'args' implicitly has an 'any[]' type.
|
||
|
function func4(z= null, w= undefined) { }; // error at "z,w"
|
||
|
~~~~~~~
|
||
|
!!! Parameter 'z' implicitly has an 'any' type.
|
||
|
~~~~~~~~~~~~
|
||
|
!!! Parameter 'w' implicitly has an 'any' type.
|
||
|
|
||
|
// these shouldn't be errors
|
||
|
function noError1(x= 3, y= 2) { };
|
||
|
function noError2(x: number, y: string) { };
|
||
|
|