diff --git a/react-router/history-tests.ts b/react-router/history-tests.ts index 92b3794e18..6c3096e48a 100644 --- a/react-router/history-tests.ts +++ b/react-router/history-tests.ts @@ -129,4 +129,14 @@ let input = { value: "" }; history.createPath('/the/path') // /base/the/path history.push('/the/path') // push /base/the/path -} \ No newline at end of file +} + +{ + let history = createHistory() + + const { pathname, query, search, state} = history.getCurrentLocation() + console.log(pathname) + console.log(query) + console.log(search) + console.log(state) +} diff --git a/react-router/history.d.ts b/react-router/history.d.ts index 5f94ea3657..a691b8784b 100644 --- a/react-router/history.d.ts +++ b/react-router/history.d.ts @@ -29,6 +29,7 @@ declare namespace HistoryModule { createPath(path: LocationDescriptor): Path createHref(path: LocationDescriptor): Href createLocation(path?: LocationDescriptor, action?: Action, key?: LocationKey): Location + getCurrentLocation: () => Location /** @deprecated use a location descriptor instead */ createLocation(path?: Path, state?: LocationState, action?: Action, key?: LocationKey): Location