From b04bc434c91d27d93509a682ec9592d9d13fc4ff Mon Sep 17 00:00:00 2001 From: Rob Pilling Date: Sat, 16 Mar 2024 13:07:45 +0000 Subject: [PATCH] layout.d.ts: correctly assign { [id]: T } for layout elements --- typescript/types/layout.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/typescript/types/layout.d.ts b/typescript/types/layout.d.ts index 2810026ca..58aa98ecd 100644 --- a/typescript/types/layout.d.ts +++ b/typescript/types/layout.d.ts @@ -7,7 +7,7 @@ type ExtractIds = [Depth] extends [never] ? never : (T extends { id?: infer Id extends string } - ? { [k in Id]: T } + ? { [k in Id]: { -readonly [P in keyof T]: T[P] } } : never) | ( @@ -34,6 +34,7 @@ declare module Layout { setUI(): void; }; + // Note: you must use new Layout({...} as const) to have ids inferred var Layout: { new ( hier: T,