Skip to content

Commit

Permalink
Update Types to Match React Router Updates
Browse files Browse the repository at this point in the history
Fixes a type mismatch caused by change remix-run/react-router#9366 in react-router code.
  • Loading branch information
philipatkinson authored and AbhiPrasad committed Oct 19, 2022
1 parent 052aa6b commit 041f6aa
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions packages/react/src/reactrouterv6.tsx
Expand Up @@ -8,14 +8,24 @@ import React from 'react';

import { Action, Location } from './types';

interface RouteObject {
caseSensitive?: boolean;
children?: RouteObject[];
element?: React.ReactNode;
index?: boolean;
path?: string;
interface NonIndexRouteObject {
caseSensitive?: boolean;
children?: RouteObject[];
element?: React.ReactNode | null;
index?: false;
path?: string;
}

interface IndexRouteObject {
caseSensitive?: boolean;
children?: undefined;
element?: React.ReactNode | null;
index?: true;
path?: string;
}

type RouteObject = IndexRouteObject | NonIndexRouteObject;

type Params<Key extends string = string> = {
readonly [key in Key]: string | undefined;
};
Expand Down

0 comments on commit 041f6aa

Please sign in to comment.