We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I have a component that extends from a base component, example:
const BaseText = styled("div", { fontSize: "$1", variants: { variant: { blueberry: { color: "$purple" } } } }); const Text = styled(BaseText, { variants: { variant: { tomato: { color: "$tomato" } } } });
<Text variant="tomato">tomato</Text> // ok <Text variant="blueberry">blueberry</Text> // typescript error
But when using the Text component with the variant in the BaseText, it returns the following Typescript error: No overload matches this call.
No overload matches this call.
Shouldn't variants from the base component be inherited? It seems to be a Typescript error because it gets rendered correctly.
Don't display any Typescript error.
One workaround that made the error go away was adding an empty variant with the same name of the base component into the composed component:
const Text = styled(BaseText, { variants: { variant: { blueberry: {}, // <----- variant from base component but empty tomato: { color: "$tomato" } } } });
Is there another solution without having to replicate all the base variants like so?
The text was updated successfully, but these errors were encountered:
Hmm. This looks like a regression. Thanks for raising it!
Sorry, something went wrong.
This is a duplicate of #749 which is now fixed under a canary release. could you please upgrade to the latest canary1.2.7-0 and test again?
1.2.7-0
Hi @hadihallak, just tested it with the 1.2.7-0 and also 1.2.7 version but still not working. Check out the same codesandbox at: https://codesandbox.io/s/crazy-mcnulty-kjjri
No branches or pull requests
Bug report
Describe the bug
I have a component that extends from a base component, example:
But when using the Text component with the variant in the BaseText, it returns the following Typescript error:
No overload matches this call.
Shouldn't variants from the base component be inherited? It seems to be a Typescript error because it gets rendered correctly.
To Reproduce
Expected behavior
Don't display any Typescript error.
System information
Additional context
One workaround that made the error go away was adding an empty variant with the same name of the base component into the composed component:
Is there another solution without having to replicate all the base variants like so?
The text was updated successfully, but these errors were encountered: