Consider this code:
var a = [];
for (var i in a)
/* nothing */;
var i : number;
i = 9;
If I compile this, the compiler complains about the last line, saying, "Cannot convert 'number' to 'string'".
Presumably the for..in loop created i as a string, but I would have expected the compiler to complain about var i : number rather than wait until i = 9 before it complained.
If I change var i : number to var i : number = 8, the compiler still doesn't complain until it reaches i = 9.
Is this a bug, or am I missing something?