UNPKG

react-layered

Version:

Welcome to react-layered! If you've ever found yourself lost in the jungle of z-index layers, fighting the chaos of overlapping UI elements, then buckle up! This tiny, mighty package is your guide to taming that wild z-index safari in your React projects.

15 lines (14 loc) 457 B
export type Layer<Keys extends string[]> = Keys[number] | LayerObject<Keys[number]>; export type LayerObject<Keys> = { key: Keys; slots?: number; parts?: string[]; }; export type LayersType<Keys extends string[]> = Layer<Keys>[]; export type LayersToObject<Layers extends LayersType<string[]>> = { [K in Layers[number] as K extends { key: infer Key; } ? Key : K]: K extends { key: string; } ? Omit<K, "key"> : {}; };