busbud / tailwind-buddy

Tailwind Buddy: Your Friendly Helper for Composing Tailwind Classes 🎨
https://busbud.github.io/tailwind-buddy/
12 stars 1 forks source link

[typescript] : Component definition - compound variants conditions typescript autocomplete #27

Open flozero opened 1 month ago

flozero commented 1 month ago

I believe the last performance improvements releases have created the typescript auto complete to stop working for compound conditions definition for external props. Variants conditions are still auto complete

what I mean is:

interface OtherProps { 
 isDisabled: boolean
}

const btn = compose({
 variants: {
   animal: // default variants def
 }
 compoundVariants: [
   {
     conditions: {
       isDisabled: true, // working but not auto complete anymore
      animal: "cat" // working and auto complete
     },
      class: "bg-red-500"
   }
 ],
defaultVariants: }
 animal: "dog"
}
})<OtherProps>()

// this usage is still auto complete properly 
btn({
 animal: "cat",
 isDisabled: true
})

this bug is really limited and does not affect usage. But still make the devex experience for the creator of the lib a bit less good.

As the typing is a bit hard for this one. It will probably take time to fix.