You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
I am building a React UI Component library, and using tailwind-variants for the styles of the component.
for the component props, I am extending VariantProps to have the component variants included in the props:
however after I built the library and published it to NPM when I want to use any component in my project, typescript always throws an error on the component variants.
my button styles:
import Button component from the package and use it in your project:
import { Button } from 'tailwind-variants-issue'
function App() {
return (
<div className="App">
<Button
variant="link"
color="gray"
/>
</div>
);
}
3.typescript will throw an error on the variant/color props with the following message:
TS2322: Type string is not assignable to type never
Expected behavior
I expected the types and intellisense to work as expected with correct types and props names,
but it does not work
Screenshots
Additional context
I thought it might be an IDE issue, I have tried it in Webstorm and VSCode and had the same issue, however when I hard coded the variants it worked without any issue:
@yaman3bd It looks like you are on an old version of Tailwind Variants. Please update to the latest version and then see if you can still reproduce it.
@yaman3bd It looks like you are on an old version of Tailwind Variants. Please update to the latest version and then see if you can still reproduce it.
@yaman3bd still happens even on the latest version of tailwind-variants
@yaman3bd It looks like you are on an old version of Tailwind Variants. Please update to the latest version and then see if you can still reproduce it.
@mskelton
I have upgraded to the latest version and now I have a new run time error:
Uncaught TypeError: Cannot read properties of undefined (reading 'twMerge')
Describe the bug
I am building a React UI Component library, and using
tailwind-variants
for the styles of the component.for the component props, I am extending
VariantProps
to have the component variants included in the props:however after I built the library and published it to NPM when I want to use any component in my project, typescript always throws an error on the component variants.
my button styles:
To Reproduce
Steps to reproduce the behavior:
I have made this minimal reproducible example:
https://github.com/yaman3bd/tailwind-variants-issue
3.typescript will throw an error on the variant/color props with the following message:
Expected behavior
I expected the types and intellisense to work as expected with correct types and props names,
but it does not work
Screenshots
Additional context
I thought it might be an IDE issue, I have tried it in Webstorm and VSCode and had the same issue, however when I hard coded the variants it worked without any issue:
The text was updated successfully, but these errors were encountered: