Skip to content

Commit d9d8b8e

Browse files
committed
Improve AgnosticBaseRouteObject type for projects using exactOptionalPropertyTypes
Projects that use typescript with the exactOptionalPropertyTypes=true setting see a type error when using react-router. The workaround of using skipLibCheck=false is not desirable as it weakens type-system accuracy for the whole project. https://www.typescriptlang.org/tsconfig/#skipLibCheck Fixes #10392 Fixes #11991 Fixes #14504
1 parent 1dbf8e3 commit d9d8b8e

File tree

1 file changed

+8
-8
lines changed
  • packages/react-router/lib/router

1 file changed

+8
-8
lines changed

packages/react-router/lib/router/utils.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -628,14 +628,14 @@ export type LazyRouteDefinition<R extends AgnosticRouteObject> =
628628
* Base RouteObject with common props shared by all types of routes
629629
*/
630630
type AgnosticBaseRouteObject = {
631-
caseSensitive?: boolean;
632-
path?: string;
633-
id?: string;
634-
middleware?: MiddlewareFunction[];
635-
loader?: LoaderFunction | boolean;
636-
action?: ActionFunction | boolean;
637-
hasErrorBoundary?: boolean;
638-
shouldRevalidate?: ShouldRevalidateFunction;
631+
caseSensitive?: boolean | undefined;
632+
path?: string | undefined;
633+
id?: string | undefined;
634+
middleware?: MiddlewareFunction[] | undefined;
635+
loader?: LoaderFunction | boolean | undefined;
636+
action?: ActionFunction | boolean | undefined;
637+
hasErrorBoundary?: boolean | undefined;
638+
shouldRevalidate?: ShouldRevalidateFunction | undefined;
639639
handle?: any;
640640
lazy?: LazyRouteDefinition<AgnosticBaseRouteObject>;
641641
};

0 commit comments

Comments
 (0)