From 6f1691ad31daaf071a83458289937d01cb8361c8 Mon Sep 17 00:00:00 2001 From: Boris Sergeyev Date: Sat, 27 Oct 2018 19:32:08 +0200 Subject: [PATCH] [redux-first-router] update defenitions for new major version (2.1.0) https://github.com/faceyspacey/redux-first-router/blob/master/docs/migration.md --- types/redux-first-router/index.d.ts | 12 ++++++++---- types/redux-first-router/redux-first-router-tests.ts | 5 +++-- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/types/redux-first-router/index.d.ts b/types/redux-first-router/index.d.ts index 928be92c6c..2184deed0b 100644 --- a/types/redux-first-router/index.d.ts +++ b/types/redux-first-router/index.d.ts @@ -1,10 +1,11 @@ -// Type definitions for redux-first-router 1.10 +// Type definitions for redux-first-router 2.1 // Project: https://github.com/faceyspacey/redux-first-router#readme // Definitions by: Valbrand // viggyfresh // janb87 // corydeppen // jscinoz +// surgeboris // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.4 @@ -64,8 +65,10 @@ export interface ReceivedActionMeta { }; } +export type HistoryEntries = Array<{ pathname: string }>; + export interface HistoryData { - entries: Array<{ pathname: string }>; + entries: HistoryEntries; index: number; length: number; } @@ -203,6 +206,8 @@ export interface Options { initialDispatch?: boolean; querySerializer?: QuerySerializer; navigators?: NavigatorsConfig; + initialEntries?: HistoryEntries; + createHistory?(): History; } export type Params = object; @@ -227,9 +232,8 @@ export function canGoBack(): boolean; export function canGoForward(): boolean; export function connectRoutes( - history: History, routesMap: RoutesMap, - options?: Options + options?: Options, ): { reducer: Reducer>; middleware: Middleware; diff --git a/types/redux-first-router/redux-first-router-tests.ts b/types/redux-first-router/redux-first-router-tests.ts index cf3f772d9e..5297be4175 100644 --- a/types/redux-first-router/redux-first-router-tests.ts +++ b/types/redux-first-router/redux-first-router-tests.ts @@ -58,7 +58,7 @@ const { enhancer, initialDispatch, thunk, -} = connectRoutes(history, routesMap, { +} = connectRoutes(routesMap, { initialDispatch: false, onBeforeChange: (dispatch, getState) => { dispatch; // $ExpectType Dispatch @@ -71,7 +71,8 @@ const { title: state => { const title = state.location.pathname; // $ExpectType string return title; - } + }, + createHistory: () => history, }); const dumbMiddleware: Middleware = store => next => action => next(action);