TypeScript Version: 2.3.3
Code
String.fromCharCode(...new Uint8Array(0));
Expected behavior:
I would expect there is no compile error.
Actual behavior:
I have to write this code:
String.fromCharCode(...Array.from(new Uint8Array(0)));
In cases where the value is iterable (i.e. has a Symbol.iterator
), we should issue this error message
Type '{0}' can only be iterated through when using the '--downlevelIteration' flag.
For people who come here from search, for me, using "target": "es6"
fixed this. Before I didn't have any target
configuration in tsconfig.json
. This is with TypeScript 2.8.1.
Most helpful comment
In cases where the value is iterable (i.e. has a
Symbol.iterator
), we should issue this error message