Summary
A rest element over a typed-array source binds a typed array rather than a fresh Array, unlike ECMA-262 (array destructuring collects the rest into a new Array via the iterator protocol):
const [a, ...rest] = new Uint8Array([1, 2, 3]);
console.log(rest, Array.isArray(rest));
// SharpTS (interp): Uint8Array(2) [2, 3] false
// tsc/JS : [2, 3] true
This is the typed-array analog of #753 (which fixed the string case). Typed arrays stay on the index/slice fast path in Interpreter.NormalizeArrayDestructureSource (and the compiled ArrayDestructureSource IList pass-through), and TypedArray.prototype.slice yields a typed array.
Fix shape
Mirror the #753 string fix: drop SharpTSTypedArray/SharpTSBuffer from the destructure pass-through so the source materializes through GetIterableElements into a SharpTSArray (a small copy per typed-array destructure; the issue author for #753 accepted the equivalent trade-off). Non-rest element values are unchanged. NOTE: compiled-mode typed arrays are blocked by a separate constructor bug — see the companion issue.
Summary
A rest element over a typed-array source binds a typed array rather than a fresh
Array, unlike ECMA-262 (array destructuring collects the rest into a new Array via the iterator protocol):This is the typed-array analog of #753 (which fixed the string case). Typed arrays stay on the index/
slicefast path inInterpreter.NormalizeArrayDestructureSource(and the compiledArrayDestructureSourceIList pass-through), andTypedArray.prototype.sliceyields a typed array.Fix shape
Mirror the #753 string fix: drop
SharpTSTypedArray/SharpTSBufferfrom the destructure pass-through so the source materializes throughGetIterableElementsinto aSharpTSArray(a small copy per typed-array destructure; the issue author for #753 accepted the equivalent trade-off). Non-rest element values are unchanged. NOTE: compiled-mode typed arrays are blocked by a separate constructor bug — see the companion issue.