Used React.ComponentProps for getting FormField props but getting weird ts error in FormField's control prop when passing form.control to control prop #10567
Answered
by
leapful
homocodian
asked this question in
Q&A
-
Hey guys, I have extracted FormField component of shadcn's ui but I am getting weird error on control prop, used React.componentProps for getting props of FormField component. |
Beta Was this translation helpful? Give feedback.
Answered by
leapful
Jun 24, 2023
Replies: 1 comment
-
@Ashish-singh-dev You must pass generic field values type to your TextInputProps in order to infer the type of Working demo: https://stackblitz.com/edit/stackblitz-starters-2acueq?file=pages%2Findex.tsx,components%2Ftext-input.tsx |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
homocodian
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@Ashish-singh-dev
You must pass generic field values type to your TextInputProps in order to infer the type of
form.control
.Working demo: https://stackblitz.com/edit/stackblitz-starters-2acueq?file=pages%2Findex.tsx,components%2Ftext-input.tsx