2014-09-12 22:35:07 +02:00
|
|
|
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'.
|
|
|
|
|
|
|
|
|
2014-07-13 01:04:16 +02:00
|
|
|
==== tests/cases/compiler/forIn.ts (2 errors) ====
|
|
|
|
var arr = null;
|
|
|
|
for (var i:number in arr) { // error
|
2014-07-19 02:30:06 +02:00
|
|
|
~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2404: The left-hand side of a 'for...in' statement cannot use a type annotation.
|
2014-07-13 01:04:16 +02:00
|
|
|
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;
|
|
|
|
~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2304: Cannot find name 'k'.
|
2014-07-13 01:04:16 +02:00
|
|
|
}
|