type StylePropSource = string | Readonly> | undefined type StylePropWords = Value extends `${infer A} ${infer B} ${infer C} ${infer D} ${infer E} ${infer F} ${infer G} ${infer H} ${infer Tail}` ? A | B | C | D | E | F | G | H | StylePropWords : Value extends `${infer Head} ${infer Tail}` ? Head | StylePropWords : Value type StylePropKeys = Source extends string ? StylePropWords : Source extends Readonly> ? keyof Source : never export const toStylePropsObject = ( ...sources: Sources ): { [Key in Exclude, string>, ''>]: true } => { const out: Record = {} for (const source of sources) { if (!source) continue for (const key of typeof source === 'string' ? source.split(' ') : Object.keys(source)) { if (key) out[key] = true } } return out as { [Key in Exclude, string>, ''>]: true } }