@types/redux-first-router
Advanced tools
Comparing version 1.10.1 to 1.10.2
@@ -21,16 +21,16 @@ // Type definitions for redux-first-router 1.10 | ||
export type StateGetter = () => object; | ||
export type StateGetter<TState = any> = () => TState; | ||
export type RouteString = string; | ||
export type RouteThunk = ( | ||
export type RouteThunk<TState = any> = ( | ||
dispatch: Dispatch<any>, | ||
getState: StateGetter | ||
getState: StateGetter<TState>, | ||
) => any | Promise<any>; | ||
export type RouteObject<TKeys> = TKeys & { | ||
export type RouteObject<TKeys = {}, TState = any> = TKeys & { | ||
capitalizedWords?: boolean; | ||
navKey?: string; | ||
path: string; | ||
thunk?: RouteThunk; | ||
thunk?: RouteThunk<TState>; | ||
fromPath?(path: string, key?: string): string; | ||
@@ -40,6 +40,6 @@ toPath?(param: string, key?: string): string; | ||
export type Route<TKeys = {}> = RouteString | RouteObject<TKeys>; | ||
export type Route<TKeys = {}, TState = any> = RouteString | RouteObject<TKeys, TState>; | ||
export interface RoutesMap<TKeys = {}> { | ||
[key: string]: Route<TKeys>; | ||
export interface RoutesMap<TKeys = {}, TState = any> { | ||
[key: string]: Route<TKeys, TState>; | ||
} | ||
@@ -82,3 +82,3 @@ | ||
export interface LocationState { | ||
export interface LocationState<TKeys = {}, TState = any> { | ||
pathname: string; | ||
@@ -92,3 +92,3 @@ type: string; | ||
history: Nullable<HistoryData>; | ||
routesMap: RoutesMap; | ||
routesMap: RoutesMap<TKeys, TState>; | ||
hasSSR?: boolean; | ||
@@ -145,13 +145,13 @@ } | ||
export interface Router { | ||
export interface Router<TState = any> { | ||
getStateForActionOriginal( | ||
action: object, | ||
state: Nullable<object> | ||
): Nullable<object>; | ||
state: Nullable<TState> | ||
): Nullable<TState>; | ||
getStateForAction( | ||
action: object, | ||
state: Nullable<object> | ||
): Nullable<object>; | ||
state: Nullable<TState> | ||
): Nullable<TState>; | ||
getPathAndParamsForState( | ||
state: object | ||
state: TState | ||
): { path: Nullable<string>; params: Nullable<Params> }; | ||
@@ -161,12 +161,12 @@ getActionForPathAndParams(path: string): Nullable<object>; | ||
export interface Navigator { | ||
router: Router; | ||
export interface Navigator<TState = any> { | ||
router: Router<TState>; | ||
} | ||
export interface Navigators { | ||
[key: string]: Navigator; | ||
export interface Navigators<TState = any> { | ||
[key: string]: Navigator<TState>; | ||
} | ||
export type SelectLocationState = (state: object) => LocationState; | ||
export type SelectTitleState = (state: object) => string; | ||
export type SelectLocationState<TKeys = {}, TState = any> = (state: TState) => LocationState<TKeys, TState>; | ||
export type SelectTitleState<TState = any> = (state: TState) => string; | ||
@@ -178,35 +178,35 @@ export interface QuerySerializer { | ||
export interface NavigatorsConfig { | ||
navigators: Navigators; | ||
patchNavigators(navigators: Navigators): void; | ||
export interface NavigatorsConfig<TKeys = {}, TState = any> { | ||
navigators: Navigators<TState>; | ||
patchNavigators(navigators: Navigators<TState>): void; | ||
actionToNavigation( | ||
navigators: Navigators, | ||
navigators: Navigators<TState>, | ||
action: object, // TODO check this | ||
navigationAction: Nullable<NavigationAction>, | ||
route: Nullable<Route> | ||
route: Nullable<Route<TKeys, TState>> | ||
): object; | ||
navigationToAction( | ||
navigators: Navigators, | ||
store: Store<any>, | ||
routesMap: RoutesMap, | ||
navigators: Navigators<TState>, | ||
store: Store<TState>, | ||
routesMap: RoutesMap<TKeys, TState>, | ||
action: object | ||
): { | ||
action: object; | ||
navigationAction: Nullable<NavigationAction>; | ||
}; | ||
action: object; | ||
navigationAction: Nullable<NavigationAction>; | ||
}; | ||
} | ||
export interface Options { | ||
title?: string | SelectTitleState; | ||
location?: string | SelectLocationState; | ||
export interface Options<TKeys = {}, TState = any> { | ||
title?: string | SelectTitleState<TState>; | ||
location?: string | SelectLocationState<TKeys, TState>; | ||
notFoundPath?: string; | ||
scrollTop?: boolean; | ||
onBeforeChange?(dispatch: Dispatch<any>, getState: StateGetter): void; | ||
onAfterChange?(dispatch: Dispatch<any>, getState: StateGetter): void; | ||
onBackNext?(dispatch: Dispatch<any>, getState: StateGetter): void; | ||
onBeforeChange?(dispatch: Dispatch<any>, getState: StateGetter<TState>): void; | ||
onAfterChange?(dispatch: Dispatch<any>, getState: StateGetter<TState>): void; | ||
onBackNext?(dispatch: Dispatch<any>, getState: StateGetter<TState>): void; | ||
restoreScroll?(history: History): ScrollBehavior; | ||
initialDispatch?: boolean; | ||
querySerializer?: QuerySerializer; | ||
navigators?: NavigatorsConfig; | ||
navigators?: NavigatorsConfig<TKeys, TState>; | ||
} | ||
@@ -221,5 +221,5 @@ | ||
export function actionToPath( | ||
export function actionToPath<TKeys = {}, TState = any>( | ||
action: ReceivedAction, | ||
routesMap: RoutesMap, | ||
routesMap: RoutesMap<TKeys, TState>, | ||
querySerializer?: QuerySerializer | ||
@@ -236,13 +236,13 @@ ): string; | ||
export function connectRoutes( | ||
export function connectRoutes<TKeys = {}, TState = any>( | ||
history: History, | ||
routesMap: RoutesMap, | ||
options?: Options | ||
routesMap: RoutesMap<TKeys, TState>, | ||
options?: Options<TKeys, TState> | ||
): { | ||
reducer: Reducer<LocationState>; | ||
middleware: Middleware; | ||
thunk(store: Store<any>): Promise<Nullable<RouteThunk>>; | ||
enhancer: GenericStoreEnhancer; | ||
initialDispatch?(): void; | ||
}; | ||
reducer: Reducer<LocationState<TKeys, TState>>; | ||
middleware: Middleware; | ||
thunk(store: Store<TState>): Promise<Nullable<RouteThunk<TState>>>; | ||
enhancer: GenericStoreEnhancer; | ||
initialDispatch?(): void; | ||
}; | ||
@@ -259,5 +259,5 @@ export function go(n: number): void; | ||
export function pathToAction( | ||
export function pathToAction<TKeys = {}, TState = any>( | ||
pathname: string, | ||
routesMap: RoutesMap | ||
routesMap: RoutesMap<TKeys, TState> | ||
): ReceivedAction; | ||
@@ -264,0 +264,0 @@ |
{ | ||
"name": "@types/redux-first-router", | ||
"version": "1.10.1", | ||
"version": "1.10.2", | ||
"description": "TypeScript definitions for redux-first-router", | ||
@@ -38,4 +38,4 @@ "license": "MIT", | ||
}, | ||
"typesPublisherContentHash": "b9632d4ada5e5f32f8962b2119aa7db1fd04d37f4ed1288f2b5b1973dd99ae2e", | ||
"typesPublisherContentHash": "eeeab26f6bd2d55ea06cd5ab237b4c70305130976013ff1bc343994a68a2d03a", | ||
"typeScriptVersion": "2.4" | ||
} |
@@ -11,3 +11,3 @@ # Installation | ||
Additional Details | ||
* Last updated: Wed, 15 Nov 2017 11:28:31 GMT | ||
* Last updated: Wed, 17 Jan 2018 22:17:28 GMT | ||
* Dependencies: redux, history | ||
@@ -14,0 +14,0 @@ * Global values: none |
Sorry, the diff of this file is not supported yet
10000