From b83a05d33569361f3ebe1ea3dfdb5bfd5499749d Mon Sep 17 00:00:00 2001 From: Jan Bevers Date: Tue, 30 Aug 2016 17:07:55 +0200 Subject: [PATCH] Added missing method getCurrentLocation to react-router/history --- react-router/history-tests.ts | 12 +++++++++++- react-router/history.d.ts | 1 + 2 files changed, 12 insertions(+), 1 deletion(-) 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