ts-clsx
v2.4.1
Published
Rewrite clsx in TypeScript.
Downloads
55
Maintainers
Readme
ts-clsx
Rewrite clsx in TypeScript, but no default export.
Install
ni ts-clsx
Usage
import { clsx } from 'ts-clsx'
clsx('foo', [1 && 'bar', { baz: false, bat: null }, ['hello', ['world']]], 'cya')
// => 'foo bar hello world cya'
// Lite version, accepts only string arguments
import { clsx } from 'ts-clsx/lite'
clsx('hello', true && 'foo', false && 'bar', { foo: true }, ['hello', ['world']])
// => "hello foo"
Tailwind Support
- VS Code + Tailwind Intellisense Extension
- Add the following to your
settings.json
{
"tailwindCSS.experimental.classRegex": [
["clsx\\(([^)]*)\\)", "(?:'|\"|`)([^']*)(?:'|\"|`)"]
]
}