Files
scriptc/tests/corpus/2800-array-expression-consumers.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

22 lines
598 B
TypeScript

let fallbackCalls = 0;
function fallback(): string {
fallbackCalls++;
return "fallback";
}
const empty: string | undefined = "";
const missing: string | undefined = undefined;
console.log("nullish", (empty ?? fallback()).length, fallbackCalls);
console.log("nullish", (missing ?? fallback()).length, fallbackCalls);
const numbers: number[] = [3.9];
let unaryCalls = 0;
function optionalNumber(): number {
unaryCalls++;
return numbers[1];
}
console.log("unary", -numbers[0], ~optionalNumber(), unaryCalls);
const grid: number[][] = [[]];
grid[0][0] = 7;
console.log("nested", grid[0][0]);