Files
scriptc/tests/corpus/1054-comptime-modules/tables.ts
2026-07-22 18:08:04 -05:00

16 lines
425 B
TypeScript

// comptime feeding module globals: the baked values are ordinary file-scope
// consts — exported, imported, and read across the module graph.
export const CUBES: number[] = comptime(() => {
const t: number[] = [];
for (let i = 1; i <= 10; i++) {
t.push(i * i * i);
}
return t;
});
export const LABEL = comptime(() => "cubes" + "!".repeat(2));
export function lookup(i: number): number {
return CUBES[i];
}