support for conditional props based on variant #200
Unanswered
amaankulshreshtha
asked this question in
Q&A
Replies: 1 comment
-
What happens if |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
There are instances where we only need certain props based on a variation of the component.
For example:
Let's say we have an
Input
component and there are two variations of that component;valid
andinvalid
. We would like to pass a prop callederrorMsg
only when the Inputvariant
is set toinvalid
.I tried using "discriminated union"
This throws a Types incompatibility error.
Could you please tell me if there is a way to achieve this functionality?
If not can the support for this functionality be added?
Beta Was this translation helpful? Give feedback.
All reactions