layout.d.ts: correctly assign { [id]: T } for layout elements

pull/3252/head
Rob Pilling 2024-03-16 13:07:45 +00:00
parent 6ff12f54cf
commit b04bc434c9
1 changed files with 2 additions and 1 deletions

View File

@ -7,7 +7,7 @@ type ExtractIds<T extends Layout.Hierarchy, Depth extends Prev[number] = 9> =
[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 <T extends Hierarchy>(
hier: T,