Closed jamesb3ll closed 3 years ago
Hey @jamesb3ll thanks for this, haven't kept tabs on this repo recently so apologies for the delay. This change seems reasonable. I am no typescript expert either 😅
Happy to merge here but not sure when I will get to publish. Did you know that the parent project of this exists https://twind.dev? It is a bit more mature and might suite your needs better.
Thanks again for the contribution.
Thanks for merging Luke! Looks like I already had Twind starred on GitHub but completely forgot about it, I'll check it out. Maybe add to top of the readme that Twind is the parent project and this is no longer maintained.
Function call passing an array like the example below, falsey items will be omitted, but the types don't reflect that (
string[]
)I originally fixed this by making it accept
Array<string | boolean>
, althoughow([true])
will result in"true"
.I'm quite new to TS, but I guess to include all falsey values I could make it
Array<string | false | "" | 0 | NaN | null | undefined>
, but that seems too much and new falsey type could be added (eg. BigInt:!!0n === false
).Typescript normally prefers being explicit so consumers can convert falsey values to boolean (
!!
).So
Array<string | false>
seems like the best solution.Also, thanks for the great and interesting library, I used it to convert a CRA styled-components app to tailwind without having to set up all the tailwind processing, plus I'm not sure CRA supports Tailwind out-of-the-box.