function __cfHardenFn(fn: Function) { Object.freeze(fn); const prototype = fn.prototype; if (prototype && typeof prototype === "object") { Object.freeze(prototype); } return fn; } import { __cfHelpers } from "commonfabric"; import { Writable, computed, pattern } from "commonfabric"; const define = undefined; const runtimeDeps = undefined; const __cfAmdHooks = undefined; const __cfLift_1 = __cfHelpers.lift<{ value: __cfHelpers.ReadonlyCell; factors: number[]; }, number>(({ value, factors }) => value.get() * factors[1]!, { type: "object", properties: { value: { type: "number", asCell: ["readonly"] }, factors: { type: "array", items: { type: "number" } } }, required: ["value", "factors"] } as const satisfies __cfHelpers.JSONSchema, { type: "number" } as const satisfies __cfHelpers.JSONSchema); // FIXTURE: computed-array-element-access // Verifies: an array variable accessed by index inside a computed is captured as a whole array // computed(() => expr) → lift(schema, schema)({ value, factors }) // Context: `factors[1]!` uses bracket access; the entire `factors` array is captured export default pattern(() => { const value = new Writable(10, { type: "number" } as const satisfies __cfHelpers.JSONSchema).for("value", true); const factors = [2, 3, 4]; const result = __cfLift_1({ value: value, factors: factors }).for("result", true); return result; }, false as const satisfies __cfHelpers.JSONSchema, { type: "number" } as const satisfies __cfHelpers.JSONSchema); // @ts-ignore: Internals function h(...args: any[]) { return __cfHelpers.h.apply(null, args); } __cfHardenFn(h); __cfReg({ __cfLift_1 });