TypeScript/tests/baselines/reference/noImplicitAnyForIn.errors.txt

42 lines
1.1 KiB
Plaintext

==== 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];
~~~~~~~
!!! 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];
~~~~~
!!! Index signature of object type implicitly has an 'any' type.
}
}
for (var a in x) {
// Should yield an implicit 'any' error.
var b;
~
!!! 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 = [[]] || [];
~
!!! Variable 'n' implicitly has an 'any[][]' type.
for (n[idx++] in m);
~~~~~~~~
!!! The left-hand side of a 'for...in' statement must be of type 'string' or 'any'.