Merge pull request #30078 from surgeboris/redux-first-router

[redux-first-router] update defenitions for new major version (2.1.0)
This commit is contained in:
Daniel Rosenwasser
2018-10-30 13:04:32 -07:00
committed by GitHub
2 changed files with 11 additions and 6 deletions
+8 -4
View File
@@ -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 <https://github.com/Valbrand>
// viggyfresh <https://github.com/viggyfresh>
// janb87 <https://github.com/janb87>
// corydeppen <https://github.com/corydeppen>
// jscinoz <https://github.com/jscinoz>
// surgeboris <https://github.com/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<TKeys = {}, TState = any> {
initialDispatch?: boolean;
querySerializer?: QuerySerializer;
navigators?: NavigatorsConfig<TKeys, TState>;
initialEntries?: HistoryEntries;
createHistory?(): History;
}
export type Params = object;
@@ -227,9 +232,8 @@ export function canGoBack(): boolean;
export function canGoForward(): boolean;
export function connectRoutes<TKeys = {}, TState = any>(
history: History,
routesMap: RoutesMap<TKeys, TState>,
options?: Options<TKeys, TState>
options?: Options<TKeys, TState>,
): {
reducer: Reducer<LocationState<TKeys, TState>>;
middleware: Middleware;
@@ -58,7 +58,7 @@ const {
enhancer,
initialDispatch,
thunk,
} = connectRoutes(history, routesMap, {
} = connectRoutes(routesMap, {
initialDispatch: false,
onBeforeChange: (dispatch, getState) => {
dispatch; // $ExpectType Dispatch<any>
@@ -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);