Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typescript problem with Route and react-error-boundary #430

Open
AscendingEagle opened this issue Mar 28, 2024 · 0 comments
Open

Typescript problem with Route and react-error-boundary #430

AscendingEagle opened this issue Mar 28, 2024 · 0 comments

Comments

@AscendingEagle
Copy link

There seems to be a Typescript problem with the Route tag:

If we use the react-error-boundary library like this:

const PageA: FC = () => {
  return <></>
}
export default withErrorBoundary(PageA, { FallbackComponent: ErrorFallback })

Then the following will throw a Typescript error on the component property:

<Route path="/pageA" component={PageA} />
TS2322: Type ForwardRefExoticComponent<RefAttributes<any>> is not assignable to type ComponentType<RouteComponentProps<{}>> | undefined
Type ForwardRefExoticComponent<RefAttributes<any>> is not assignable to type FunctionComponent<RouteComponentProps<{}>>
Types of property propTypes are incompatible.
Type WeakValidationMap<RefAttributes<any>> | undefined is not assignable to type
WeakValidationMap<RouteComponentProps<{}>> | undefined
Type WeakValidationMap<RefAttributes<any>> has no properties in common with type WeakValidationMap<RouteComponentProps<{}>>
index.d.ts(72, 3): The expected type comes from property component which is declared here on type IntrinsicAttributes & RouteProps<undefined, '/pageA'>

This problem does not happen with react-router-dom.

This appears to be only a syntactical error because the code still works as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant