(...args: CxArgs<T>)
| 8 | type CxArgs<T> = [...ClassNameValue[], Render<T>] | [[...ClassNameValue[], Render<T>]] |
| 9 | |
| 10 | export function cx<T = unknown>(...args: CxArgs<T>): string | ((v: T) => string) { |
| 11 | const flat = (args.length === 1 && Array.isArray(args[0]) ? args[0] : args) as [ |
| 12 | ...ClassNameValue[], |
| 13 | Render<T>, |
| 14 | ] |
| 15 | |
| 16 | const fixed = twMerge(...(flat.slice(0, -1) as ClassNameValue[])) |
| 17 | |
| 18 | return composeRenderProps(flat[flat.length - 1] as Render<T>, (cn) => twMerge(fixed, cn)) |
| 19 | } |
no outgoing calls
no test coverage detected