2014-07-13 01:04:16 +02:00
|
|
|
//// [implicitAnyDeclareFunctionWithoutFormalType.ts]
|
|
|
|
// these should be errors
|
|
|
|
function foo(x) { };
|
|
|
|
function bar(x: number, y) { }; // error at "y"; no error at "x"
|
|
|
|
function func2(a, b, c) { }; // error at "a,b,c"
|
|
|
|
function func3(...args) { }; // error at "args"
|
|
|
|
function func4(z= null, w= undefined) { }; // error at "z,w"
|
|
|
|
|
|
|
|
// these shouldn't be errors
|
|
|
|
function noError1(x= 3, y= 2) { };
|
|
|
|
function noError2(x: number, y: string) { };
|
|
|
|
|
|
|
|
|
|
|
|
//// [implicitAnyDeclareFunctionWithoutFormalType.js]
|
2014-08-14 15:21:30 +02:00
|
|
|
// these should be errors
|
2015-02-07 03:45:09 +01:00
|
|
|
function foo(x) { }
|
2014-07-13 01:04:16 +02:00
|
|
|
;
|
2015-02-07 03:45:09 +01:00
|
|
|
function bar(x, y) { }
|
2015-01-23 00:58:00 +01:00
|
|
|
; // error at "y"; no error at "x"
|
2015-02-07 03:45:09 +01:00
|
|
|
function func2(a, b, c) { }
|
2015-01-23 00:58:00 +01:00
|
|
|
; // error at "a,b,c"
|
2015-02-07 03:45:09 +01:00
|
|
|
function func3() { }
|
2015-01-23 00:58:00 +01:00
|
|
|
; // error at "args"
|
2015-02-23 21:31:40 +01:00
|
|
|
function func4(z, w) {
|
|
|
|
if (z === void 0) { z = null; }
|
|
|
|
if (w === void 0) { w = undefined; }
|
|
|
|
}
|
2015-01-23 00:58:00 +01:00
|
|
|
; // error at "z,w"
|
2014-08-14 15:21:30 +02:00
|
|
|
// these shouldn't be errors
|
2015-02-23 21:31:40 +01:00
|
|
|
function noError1(x, y) {
|
|
|
|
if (x === void 0) { x = 3; }
|
|
|
|
if (y === void 0) { y = 2; }
|
|
|
|
}
|
2014-07-13 01:04:16 +02:00
|
|
|
;
|
2015-02-07 03:45:09 +01:00
|
|
|
function noError2(x, y) { }
|
2014-07-13 01:04:16 +02:00
|
|
|
;
|