stitches
stitches copied to clipboard
TS error when applying default variants coming from another CSS style
Bug report
TypeScript doesn't get the variant type coming from another css style.
Describe the bug
I have a Text component where it has variants related to the font-weight
style. The weight
variants were extracted in another css
to be reused in other styles. In this scenario I called it as cssWeightVariants
. When applying the cssWeightVariants
in the Text style, TypeScript doesn't know the weight
variant in defaultVariants
object. It only knows the variants applied directly in the Text css.
To Reproduce
const cssWeightVariants = css({
variants: {
weight: {
normal: {
fontWeight: 400,
},
bold: {
fontWeight: 700,
},
},
},
});
const cssText = css(
{
variants: {
variant: {
base: {
color: "black",
},
},
},
defaultVariants: {
variant: "base", // TS ok
weight: "normal", // TS error here
},
},
cssWeightVariants
);
Expected behavior
TypeScript should know the weight
type coming from the external css style.
Screenshots
VSCode
System information
- OS: macOS
- Version of Stitches: 1.2.8
- Version of Node.js: 16.13.1
found the same issue recently. @hadihallak any update on this?