diff --git a/packages/react-router/index.tsx b/packages/react-router/index.tsx index 4bf872a0a5..c12b300d07 100644 --- a/packages/react-router/index.tsx +++ b/packages/react-router/index.tsx @@ -526,8 +526,10 @@ export function useOutlet(): React.ReactElement | null { * * @see https://reactrouter.com/docs/en/v6/api#useparams */ -export function useParams(): Readonly< - Params +export function useParams< + ParamsOrKey extends string | Record = string +>(): Readonly< + [ParamsOrKey] extends [string] ? Params : Partial > { let { matches } = React.useContext(RouteContext); let routeMatch = matches[matches.length - 1];