30 lines
No EOL
838 B
Text
30 lines
No EOL
838 B
Text
tests/cases/compiler/forIn.ts(2,10): error TS2404: The left-hand side of a 'for...in' statement cannot use a type annotation.
|
|
tests/cases/compiler/forIn.ts(20,4): error TS2304: Cannot find name 'k'.
|
|
|
|
|
|
==== tests/cases/compiler/forIn.ts (2 errors) ====
|
|
var arr = null;
|
|
for (var i:number in arr) { // error
|
|
~
|
|
!!! error TS2404: The left-hand side of a 'for...in' statement cannot use a type annotation.
|
|
var x1 = arr[i];
|
|
var y1 = arr[i];
|
|
}
|
|
|
|
for (var j in arr) { // ok
|
|
var x2 = arr[j];
|
|
var y2 = arr[j];
|
|
}
|
|
|
|
var arr2 = [];
|
|
for (j in arr2) { // ok
|
|
var x3 = arr2[j];
|
|
var y3 = arr2[j];
|
|
}
|
|
|
|
for (var l in arr) {
|
|
// error in the body
|
|
k[l] = 1;
|
|
~
|
|
!!! error TS2304: Cannot find name 'k'.
|
|
} |