TypeScript/tests/baselines/reference/forIn.errors.txt
2014-09-12 13:35:07 -07:00

30 lines
838 B
Plaintext

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'.
}