1
0
Fork 0

layout.d.ts: Layout type - merge extracted ids union

master
Rob Pilling 2024-03-11 22:46:35 +00:00
parent 19a041e410
commit 6ff12f54cf
1 changed files with 4 additions and 1 deletions

View File

@ -1,5 +1,8 @@
type Prev = [never, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
type UnionToIntersection<U> =
(U extends any ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never
type ExtractIds<T extends Layout.Hierarchy, Depth extends Prev[number] = 9> =
[Depth] extends [never]
? never
@ -15,7 +18,7 @@ type ExtractIds<T extends Layout.Hierarchy, Depth extends Prev[number] = 9> =
declare module Layout {
type Layouter<T extends Hierarchy> =
ExtractIds<T>
UnionToIntersection<ExtractIds<T>>
&
{
// these actually change T