49 lines
No EOL
1.8 KiB
Text
49 lines
No EOL
1.8 KiB
Text
tests/cases/compiler/noImplicitAnyForIn.ts(8,18): error TS7017: Index signature of object type implicitly has an 'any' type.
|
|
tests/cases/compiler/noImplicitAnyForIn.ts(15,18): error TS7017: Index signature of object type implicitly has an 'any' type.
|
|
tests/cases/compiler/noImplicitAnyForIn.ts(21,9): error TS7005: Variable 'b' implicitly has an 'any' type.
|
|
tests/cases/compiler/noImplicitAnyForIn.ts(29,5): error TS7005: Variable 'n' implicitly has an 'any[][]' type.
|
|
tests/cases/compiler/noImplicitAnyForIn.ts(31,6): error TS2405: The left-hand side of a 'for...in' statement must be of type 'string' or 'any'.
|
|
|
|
|
|
==== tests/cases/compiler/noImplicitAnyForIn.ts (5 errors) ====
|
|
|
|
var x: {}[] = [[1, 2, 3], ["hello"]];
|
|
|
|
for (var i in x) {
|
|
for (var j in x[i]) {
|
|
|
|
//Should yield an implicit 'any' error
|
|
var _j = x[i][j];
|
|
~~~~~~~
|
|
!!! error TS7017: Index signature of object type implicitly has an 'any' type.
|
|
}
|
|
|
|
for (var k in x[0]) {
|
|
var k1 = x[0];
|
|
|
|
//Should yield an implicit 'any' error
|
|
var k2 = k1[k];
|
|
~~~~~
|
|
!!! error TS7017: Index signature of object type implicitly has an 'any' type.
|
|
}
|
|
}
|
|
|
|
for (var a in x) {
|
|
// Should yield an implicit 'any' error.
|
|
var b;
|
|
~
|
|
!!! error TS7005: Variable 'b' implicitly has an 'any' type.
|
|
|
|
var c = a || b;
|
|
}
|
|
|
|
var idx = 0;
|
|
var m = [1, 2, 3, 4, 5];
|
|
// Should yield an implicit 'any' error.
|
|
var n = [[]] || [];
|
|
~
|
|
!!! error TS7005: Variable 'n' implicitly has an 'any[][]' type.
|
|
|
|
for (n[idx++] in m);
|
|
~~~~~~~~
|
|
!!! error TS2405: The left-hand side of a 'for...in' statement must be of type 'string' or 'any'. |