Specified diagnostic for iterating known array type without --downlevelIteration (#40070)

* Specified error message for iterating known array types without --downlevelIteration

* Added extra target info to diagnostic

* NodeList too, a classic

* PR feedback: invert to allowsStrings; required param

Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
This commit is contained in:
Josh Goldberg
2021-02-17 20:12:32 -05:00
committed by GitHub
parent 7fca9267e6
commit c3d7a56e90
11 changed files with 653 additions and 12 deletions

View File

@@ -0,0 +1,33 @@
// @target: ES5
const float32Array = new Float32Array(1);
[...float32Array];
const float64Array = new Float64Array(1);
[...float64Array];
const int16Array = new Int16Array(1);
[...int16Array];
const int32Array = new Int32Array(1);
[...int32Array];
const int8Array = new Int8Array(1);
[...int8Array];
const nodeList = new NodeList();
[...nodeList];
const uint16Array = new Uint16Array(1);
[...uint16Array];
const uint32Array = new Uint32Array(1);
[...uint32Array];
const uint8Array = new Uint8Array(1);
[...uint8Array];
const uint8ClampedArray = new Uint8ClampedArray(1);
[...uint8ClampedArray];

View File

@@ -0,0 +1,31 @@
// @target: ES6
const float32Array = new Float32Array(1);
[...float32Array];
const float64Array = new Float64Array(1);
[...float64Array];
const int16Array = new Int16Array(1);
[...int16Array];
const int32Array = new Int32Array(1);
[...int32Array];
const int8Array = new Int8Array(1);
[...int8Array];
const nodeList = new NodeList();
[...nodeList];
const uint16Array = new Uint16Array(1);
[...uint16Array];
const uint32Array = new Uint32Array(1);
[...uint32Array];
const uint8Array = new Uint8Array(1);
[...uint8Array];
const uint8ClampedArray = new Uint8ClampedArray(1);
[...uint8ClampedArray];