Open MichaelDM opened 2 years ago
Experienced the same thing trying to use shared variants but changing the defaultVariants
value for another component
We reached a TS limitation to compose variants from other components. It's quite complex. We'll need to try again, or eventually wait for TS to get better - currently there are lots of limitations we need to work around.
However, we should be able to at least prevent the error.
@peduarte, might this error prevention make it in the next release?
@MichaelDM we'll look into this 🙏
Any updates on this? This is something that would really help our team.
Bug report
Describe the bug
I am creating a variable called
sharedTypo
using thecss
function, to share styles across components. It has variant calledvariant
with a value ofh1
. I am following this part of the documentation: https://stitches.dev/docs/typescript#type-a-css-objectWhen I apply my sharedTypo to a styled component, like
const Text = styled("p", sharedTypo, {...
, my styled component has a Typescript error saying that it does not recognize the variantsvariant: h1
coming from my sharedTypo.The css is computed as expected though (it recognized the variant), which suggest that it is indeed a Typescript error versus Stitches not supporting this feature. Note: this worked with version 1.0.0, but stopped starting 1.0.1
To Reproduce
https://codesandbox.io/s/zen-boyd-v0myz?file=/src/App.tsx
Expected behavior
I expected Typescript to not display any errors.
Screenshots
System information
Additional context
Add any other context about the problem here.