Making variants optional or required based on presence in defaultVariants
#588
nayaabkhan
started this conversation in
Ideas
Replies: 1 comment 2 replies
-
It seems to me that this is by design. Variants are always optional – if not set, simply no extra style is added. If you want to make it required, just change the variants type, e.g. something like this (untested): type OptionalHeadingVariants = RecipeVariants<typeof heading>;
export type HeadingVariants = OptionalHeadingVariants & Required<Pick<OptionalHeadingVariants, 'size'>>; |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi! Thanks for a great tool-set.
I've been deep into exploring the APIs and stumbled upon something that kinda feels abnormal.
Say:
I expected
HeadingVariants
to haveweight
as optional because a default is provided, butsize
to be required:But we have all fields optional:
Thank a lot, in advance.
Beta Was this translation helpful? Give feedback.
All reactions