Skip to content

Variant types from RecipeVariants doesn't work #1035

Answered by askoufis
gabrieloureiro asked this question in Q&A
Discussion options

You must be logged in to vote

Your TextVariantSize type isn't what you think it is. It's an object containing a property size that can accept all your size variants xxs, xs, etc., rather than just a union of all your size variants.

I think to fix this you'll want to extract the variants from the recipe type:

type TextVariantSize = Required<NonNullable<RecipeVariants<typeof textStyles>>>['size'];

Alternatively, you could construct your TextProps type in a different way:

Atoms & { as?: AllowedHtmlTags } & RecipeVariants<typeof textStyles>

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@gabrieloureiro
Comment options

@askoufis
Comment options

Answer selected by gabrieloureiro
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants