mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-26 10:56:19 +08:00
63 lines
1.6 KiB
TypeScript
63 lines
1.6 KiB
TypeScript
// Type definitions for react-router-redux 5.0
|
|
// Project: https://github.com/ReactTraining/react-router/tree/master/packages/react-router-redux
|
|
// Definitions by: Huy Nguyen <https://github.com/huy-nguyen>
|
|
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
|
// TypeScript Version: 2.2
|
|
|
|
import {
|
|
Store,
|
|
Dispatch,
|
|
Action,
|
|
Middleware
|
|
} from 'redux';
|
|
import {
|
|
History,
|
|
Location,
|
|
Path,
|
|
LocationState,
|
|
LocationDescriptor
|
|
} from 'history';
|
|
import * as React from 'react';
|
|
|
|
export interface ConnectedRouterProps<State> {
|
|
store?: Store<State>;
|
|
history?: History;
|
|
}
|
|
export class ConnectedRouter<State> extends React.Component<ConnectedRouterProps<State>, {}> {}
|
|
|
|
export const LOCATION_CHANGE: string;
|
|
|
|
export interface RouterState {
|
|
location: Location | null;
|
|
}
|
|
|
|
export function routerReducer(state?: RouterState, action?: RouterAction): RouterState;
|
|
|
|
export const CALL_HISTORY_METHOD: string;
|
|
|
|
export function push(location: LocationDescriptor, state?: LocationState): RouterAction;
|
|
export function replace(location: LocationDescriptor, state?: LocationState): RouterAction;
|
|
export function go(n: number): RouterAction;
|
|
export function goBack(): RouterAction;
|
|
export function goForward(): RouterAction;
|
|
|
|
export const routerAction: {
|
|
push: typeof push
|
|
replace: typeof replace
|
|
go: typeof go
|
|
goBack: typeof goBack
|
|
goForward: typeof goForward
|
|
};
|
|
|
|
export interface LocationActionPayload {
|
|
method: string;
|
|
args?: any[];
|
|
}
|
|
|
|
export interface RouterAction extends Action {
|
|
type: typeof CALL_HISTORY_METHOD;
|
|
payload: LocationActionPayload;
|
|
}
|
|
|
|
export function routerMiddleware(history: History): Middleware;
|