lukeed / clsx

A tiny (239B) utility for constructing `className` strings conditionally.
MIT License
8.08k stars 141 forks source link

clsx/lite accepts ClassDictionary (TypeScript) #90

Closed sndrrth closed 8 months ago

sndrrth commented 8 months ago

The TS type of the new clxs/lite function includes the ClassDictionary type, but why? Dictionaries are not evaluated by this function, so passing them is useless. Wouldn't it be better to exclude it so that TS users are aware of that restriction?

lukeed commented 8 months ago

I kept it the same because you should be able to simply modify your bundler's alias config to map clsx to clsx/lite w/o changes or new errors. Also, technically, clsx/lite still accepts the non-string input values, it just doesnt do anything with them

sndrrth commented 8 months ago

Thanks for the explanation.

skyrpex commented 5 months ago

I kept it the same because you should be able to simply modify your bundler's alias config to map clsx to clsx/lite w/o changes or new errors.

That will only hide errors in runtime, no? I don't understand the reasoning 🤔