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
Uh oh!
There was an error while loading. Please reload this page.
-
There are instances where we only need certain props based on a variation of the component.
For example:
Let's say we have an
Inputcomponent and there are two variations of that component;validandinvalid. We would like to pass a prop callederrorMsgonly when the Inputvariantis 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