UNPKG

@webwriter/block-based-code

Version:

Write block-based code (e.g. Scratch) and run it.

18 lines (16 loc) 357 B
/** * Get all possible paths of an object */ type Join<K, P> = K extends string ? P extends string ? `${K}${"" extends P ? "" : "."}${P}` : never : never; /** * Get all possible paths to leaves of an object */ export type Leaves<T> = T extends object ? { [K in keyof T]-?: Join<K, Leaves<T[K]>>; }[keyof T] : "";