1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
tests/cases/compiler/implicitAnyDeclareVariablesWithoutTypeAndInit.ts(3,5): error TS7034: Variable 'y' implicitly has type 'any' in some locations where its type cannot be determined.
tests/cases/compiler/implicitAnyDeclareVariablesWithoutTypeAndInit.ts(4,13): error TS7005: Variable 'foo' implicitly has an 'any' type.
tests/cases/compiler/implicitAnyDeclareVariablesWithoutTypeAndInit.ts(5,15): error TS7006: Parameter 'k' implicitly has an 'any' type.
tests/cases/compiler/implicitAnyDeclareVariablesWithoutTypeAndInit.ts(5,20): error TS7005: Variable 'y' implicitly has an 'any' type.
==== tests/cases/compiler/implicitAnyDeclareVariablesWithoutTypeAndInit.ts (4 errors) ====
// this should be an error
var x; // no error, control flow typed
var y; // error because captured
~
!!! error TS7034: Variable 'y' implicitly has type 'any' in some locations where its type cannot be determined.
declare var foo; // error at "foo"
~~~
!!! error TS7005: Variable 'foo' implicitly has an 'any' type.
function func(k) { y }; // error at "k"
~
!!! error TS7006: Parameter 'k' implicitly has an 'any' type.
~
!!! error TS7005: Variable 'y' implicitly has an 'any' type.
func(x);
// this shouldn't be an error
var bar = 3;
var bar1: any;
declare var bar2: any;
var x1: any; var y1 = new x1;
|