为什么arr.entries()for循环在TS中不起作用? 这部作品在铬控制台为什么arr.entries()for循环在TS中不起作用?
var arr = ['a', 'b', 'c'];
var e = arr.entries();
for (let [index, elem] of e) {
debugger;
console.log(`index = ${index}, elem = ${elem}`);
}
得很好,但在打字稿2.1.4 也不知没有断点,为什么我得到这个错误在TS: Error:(67, 35) TS2495:Type 'IterableIterator<[number, string]>' is not an array type or a string type.
我可以设置为:any
但obviosuly这不是想法
问候
肖恩
我编译你的准确的代码与定位'es6',它很好。你是否编译了你发布的相同代码或其他东西? –