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
ERROR in [at-loader] ./whatever.tsx:12:34
TS2322: Type '{ children: Element; onClick: LinkedEvent<this, Event> | null; }' is not assignable to type 'DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>'.
Type '{ children: Element; onClick: LinkedEvent<this, Event> | null; }' is not assignable to type 'HTMLAttributes<HTMLElement>'.
Types of property 'onClick' are incompatible.
Type 'LinkedEvent<this, Event> | null' is not assignable to type '((event: MouseEvent<HTMLElement>) => void) | LinkedEvent<any, MouseEvent<HTMLElement>> | undefined'.
Type 'null' is not assignable to type '((event: MouseEvent<HTMLElement>) => void) | LinkedEvent<any, MouseEvent<HTMLElement>> | undefined'.
I believe this is caused by the type of linkEvent:
As far as possible solutions, I believe you could:
Change linkEvent to return undefined instead of null
Change the type of the various onWhatever handlers to accept null as a value, instead of just undefined.
The first solution would probably break backwards compatibility. For the second solution, I'm not sure what level of changes that would require, nor of the best place to add the requisite | null.
The text was updated successfully, but these errors were encountered:
Problem
After upgrading from v4.0.8 to v5.0.1 in a TypeScript/JSX project, for code like:
I get lots of errors like:
I believe this is caused by the type of
linkEvent
:being incompatible with the type of the various
onWhatever
handlers:Workaround
I can "solve" this problem like so:
However, this is not a very clean solution.
As far as possible solutions, I believe you could:
linkEvent
to returnundefined
instead ofnull
onWhatever
handlers to acceptnull
as a value, instead of justundefined
.The first solution would probably break backwards compatibility. For the second solution, I'm not sure what level of changes that would require, nor of the best place to add the requisite
| null
.The text was updated successfully, but these errors were encountered: