From 84d15a68f273d881c22ee20ec7206d2d142f5755 Mon Sep 17 00:00:00 2001 From: Onur Temizkan Date: Wed, 23 Nov 2022 13:30:08 +0000 Subject: [PATCH] fix(react): Relax React Router 6 `RouteObject` typing. --- packages/react/src/types.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/react/src/types.ts b/packages/react/src/types.ts index 2c6eaa68362e..bc6df59dbc2f 100644 --- a/packages/react/src/types.ts +++ b/packages/react/src/types.ts @@ -20,6 +20,7 @@ export interface NonIndexRouteObject { caseSensitive?: boolean; children?: RouteObject[]; element?: React.ReactNode | null; + errorElement?: React.ReactNode | null; index?: any; path?: string; } @@ -28,6 +29,7 @@ export interface IndexRouteObject { caseSensitive?: boolean; children?: undefined; element?: React.ReactNode | null; + errorElement?: React.ReactNode | null; index: any; path?: string; } @@ -35,7 +37,7 @@ export interface IndexRouteObject { // This type was originally just `type RouteObject = IndexRouteObject`, but this was changed // in https://github.com/remix-run/react-router/pull/9366, which was released with `6.4.2` // See https://github.com/remix-run/react-router/issues/9427 for a discussion on this. -export type RouteObject = IndexRouteObject | NonIndexRouteObject; +export type RouteObject = (IndexRouteObject | NonIndexRouteObject) & Record; export type Params = { readonly [key in Key]: string | undefined;