/** The value stored under `key`, created with `init` and stored first when missing. */ export function entryOf(record: Record, key: string, init: () => NoInfer): T { const existing = record[key]; if (existing !== undefined) return existing; const created = init(); record[key] = created; return created; }