Files
scriptc/tests/corpus/2791-record-optional-keys.ts
Chris Tate 94fd361b54 Implement sparse native arrays and missing-value parity (#297)
Represent ordinary JavaScript arrays with hole, value, and explicit-undefined states; add sparse side storage and carry missing values through the frontend, native backends, runtime, and Node-facing consumers.
2026-09-12 22:39:07 -05:00

14 lines
528 B
TypeScript

// Array-derived missing string keys use JavaScript ToPropertyKey: undefined -> "undefined".
const keys: string[] = ["a"];
keys.length = 2;
const source: Record<string, string> = { a: "A", undefined: "U" };
const target: Record<string, string> = {};
for (const key of keys) {
console.log("read", typeof key, source[key]);
target[key] = typeof key;
}
console.log("write", target.a, target.undefined);
const rows: { value: number }[] = [{ value: 1 }];
for (const row of rows) console.log("keys", Object.keys(row).join(","));