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.
There seems to be a Typescript problem with the
Route
tag:If we use the
react-error-boundary
library like this:Then the following will throw a Typescript error on the
component
property:This problem does not happen with
react-router-dom
.This appears to be only a syntactical error because the code still works as expected.