Files
scriptc/tests/corpus/3046-array-indexed-ref-identity.ts
Chris Tate 183a0bbcec Lower static Array fill/copyWithin and position coercion (#457)
* Coerce static Array slice and splice positions

* Lower static Array fill and copyWithin with Test262 assertions
2026-09-25 23:17:24 -05:00

14 lines
569 B
TypeScript

type Item = { label: string };
const fillValue: Item = { label: "same" };
const filled: Item[] = [{ label: "first" }, { label: "second" }, { label: "third" }];
console.log("fill-return", filled.fill(fillValue, 1) === filled);
fillValue.label = "updated";
console.log("fill-shared", JSON.stringify(filled));
const source: Item = { label: "first" };
const copied: Item[] = [source, { label: "second" }, { label: "third" }];
console.log("copy-return", copied.copyWithin(1, 0, 2) === copied);
source.label = "updated";
console.log("copy-shared", JSON.stringify(copied));