-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Description
What version of React Router are you using?
6.4.2
Steps to Reproduce
Recently installed react-router-dom v 6.4.2 and now have errors related to typings (I'm using Typescript v 4.4.4 and @types/react-router-dom v 5.3.3). After the install I get this error related to RouteProps:
An interface can only extend an object type or intersection of object types with statically known members.
Even though when I click through the imported RouteProps it takes me to the interface and they are there in the declarations file.
From the components.d.ts file:
export declare type RouteProps = PathRouteProps | LayoutRouteProps | IndexRouteProps;
Not sure if this is a compatibility issue with the @types library but switching back to react-router-dom 6.4.1 solves the typing issue.
Expected Behavior
The code compiles and runs. :(
Actual Behavior
The compiler throws errors and the code will not compile.
Compiled with problems:X
ERROR in src/AppRoutes.ts:3:40
TS2312: An interface can only extend an object type or intersection of object types with statically known members.
1 | import { RouteProps } from "react-router-dom";
2 |
> 3 | export interface AppRouteProps extends RouteProps {
| ^^^^^^^^^^
4 | title: string;
5 | // A set of properties for making a mappable list
6 | url?: string;