You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Appying styled to the result component of .withComponent() has the wrong prop types.
E.g in the following code, typescript complains that onSubmit might be of type (event: FormEvent<HTMLDivElement>) => void). I guess that the HTMLDivElement part is comming from the original Box component, which was a div:
Note the type of FormBox, references to HTMLDivElement are still there.
Full error message:
Type '(ev: React.FormEvent<HTMLFormElement>) => void' is not assignable to type '((event: FormEvent<HTMLFormElement>) => void) & ((event: FormEvent<HTMLDivElement>) => void)'.
Type '(ev: React.FormEvent<HTMLFormElement>) => void' is not assignable to type '(event: FormEvent<HTMLDivElement>) => void'.
Types of parameters 'ev' and 'event' are incompatible.
Type 'FormEvent<HTMLDivElement>' is not assignable to type 'FormEvent<HTMLFormElement>'.
Type 'HTMLDivElement' is missing the following properties from type 'HTMLFormElement': acceptCharset, action, autocomplete, elements, and 12 more.
This has been fixed in the upcoming v11. It's available on npm and no major breaking changes are planned before the final release - please try it out or wait until we release it.
Current behavior:
Appying
styled
to the result component of.withComponent()
has the wrong prop types.E.g in the following code, typescript complains that
onSubmit
might be of type(event: FormEvent<HTMLDivElement>) => void)
. I guess that theHTMLDivElement
part is comming from the originalBox
component, which was adiv
:Note the type of
FormBox
, references toHTMLDivElement
are still there.Full error message:
To reproduce:
yarn install
yarn start
Expected behavior:
Component props types should be of the end html element type.
Environment information:
Workaround
Until fixed a possible workarround is to cast the event as
any
:The text was updated successfully, but these errors were encountered: