diff --git a/types/reach__router/index.d.ts b/types/reach__router/index.d.ts index 869329ef23..f52b3954e3 100644 --- a/types/reach__router/index.d.ts +++ b/types/reach__router/index.d.ts @@ -92,7 +92,11 @@ export interface NavigateOptions { replace?: boolean; } -export class Location extends React.Component {} +export interface LocationProps { + children: LocationProviderRenderFn; +} + +export class Location extends React.Component {} export interface LocationProviderProps { history: History; diff --git a/types/reach__router/reach__router-tests.tsx b/types/reach__router/reach__router-tests.tsx index f20b11483f..56e2305a2e 100644 --- a/types/reach__router/reach__router-tests.tsx +++ b/types/reach__router/reach__router-tests.tsx @@ -1,4 +1,4 @@ -import { Link, RouteComponentProps, Router } from "@reach/router"; +import { Link, Location, RouteComponentProps, Router } from "@reach/router"; import * as React from "react"; import { render } from "react-dom"; @@ -21,6 +21,17 @@ render( + + + {(context) => ( + <> +
hostname is {context.location.hostname}
+ + + )} +
, document.getElementById("app-root"), );