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
I would have opened an issue, but I can't reproduce in Codesandbox. I'm hoping someone knows how I can fix this.
After upgrading to Typescript 5.5, none of the events on polymorphic components are typed. For example <Button onClick={e => e}></Button> has e as any.
The type signature of Button is being resolved as this, locally: Button: (<C = "button">(props: any) => React.ReactElement<any, string | React.JSXElementConstructor<any>>) ....
In code sandbox, it is this: Button: (<C = "button">(props: PolymorphicComponentProps<C, ButtonProps>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>) ....
For some reason, it cannot resolve the props: import("../../core").PolymorphicComponentProps<C, ButtonProps> locally. Typescript 5.4 works fine. Any ideas?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I would have opened an issue, but I can't reproduce in Codesandbox. I'm hoping someone knows how I can fix this.
After upgrading to Typescript 5.5, none of the events on polymorphic components are typed. For example
<Button onClick={e => e}></Button>
hase
asany
.The type signature of Button is being resolved as this, locally:
Button: (<C = "button">(props: any) => React.ReactElement<any, string | React.JSXElementConstructor<any>>) ....
In code sandbox, it is this:
Button: (<C = "button">(props: PolymorphicComponentProps<C, ButtonProps>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>) ....
For some reason, it cannot resolve the
props: import("../../core").PolymorphicComponentProps<C, ButtonProps>
locally. Typescript 5.4 works fine. Any ideas?Beta Was this translation helpful? Give feedback.
All reactions