Closed lukejagodzinski closed 1 year ago
That sounds reasonable to me. Not exporting this sounds like an oversight. Would mind creating a PR?
That sounds reasonable to me. Not exporting this sounds like an oversight. Would mind creating a PR?
OK thanks. I will create PR
Actually I've just realized that there is form prop being exported but its name is just FormProps
. Closing this issue. Sorry for bothering.
What is the new or updated feature that you are suggesting?
When trying to create a wrapper component around the
ValidatedForm
component I've noticed a problem with lack of theValidatedFormProps
type. I want my wrapper component (UserForm
) to have exactly the same interface as theValidatedForm
component plus a few extra props. But it doesn't properly infer types of generics.In this case I can't pass my generic
T
down to theValidatedForm
component. However, if this library exported theValidatedFormProps
type then it would work well.Unfortunatelly, it's limitation of TS and React.ComponentProps. I've done some research and it's not possible in TS without exporting the component props type.
Basically, it goes down to this problem:
The generic information in the inferred type is lost.
Why should this feature be included?
It's just one extra import and it would improve DX when wrapping form component.