UNPKG

3.31 kBMarkdownView Raw
1# Installation
2> `npm install --save @types/react-router-redux`
3
4# Summary
5This package contains type definitions for react-router-redux (https://github.com/reactjs/react-router-redux).
6
7# Details
8Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react-router-redux.
9## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react-router-redux/index.d.ts)
10````ts
11// Type definitions for react-router-redux 5.0
12// Project: https://github.com/reactjs/react-router-redux
13// Definitions by: Huy Nguyen <https://github.com/huy-nguyen>
14// Shoya Tanaka <https://github.com/8398a7>
15// Mykolas <https://github.com/mykolas>
16// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
17// TypeScript Version: 3.0
18
19import {
20 Store,
21 Dispatch,
22 Middleware,
23 Reducer
24} from 'redux';
25import {
26 History,
27 Location,
28 Path,
29 LocationState,
30 LocationDescriptor
31} from 'history';
32import * as React from 'react';
33import { match } from 'react-router';
34
35export interface ConnectedRouterProps<State> {
36 children?: React.ReactNode;
37 store?: Store<State> | undefined;
38 history: History;
39}
40export class ConnectedRouter<State> extends React.Component<ConnectedRouterProps<State>> {}
41
42export const LOCATION_CHANGE = '@@router/LOCATION_CHANGE';
43
44export interface RouterState {
45 location: Location | null;
46}
47
48export const routerReducer: Reducer<RouterState>;
49
50export const CALL_HISTORY_METHOD = '@@router/CALL_HISTORY_METHOD';
51
52export function push(location: LocationDescriptor, state?: LocationState): RouterAction;
53export function replace(location: LocationDescriptor, state?: LocationState): RouterAction;
54export function go(n: number): RouterAction;
55export function goBack(): RouterAction;
56export function goForward(): RouterAction;
57
58export const routerActions: {
59 push: typeof push
60 replace: typeof replace
61 go: typeof go
62 goBack: typeof goBack
63 goForward: typeof goForward
64};
65
66export interface LocationActionPayload {
67 method: string;
68 args?: any[] | undefined;
69}
70
71export interface RouterAction {
72 type: typeof CALL_HISTORY_METHOD;
73 payload: LocationActionPayload;
74}
75
76export interface LocationChangeAction {
77 type: typeof LOCATION_CHANGE;
78 payload: Location & {
79 props?: {
80 match: {
81 path: string;
82 url: string;
83 params: any;
84 isExact: boolean;
85 },
86 location: Location;
87 history: History;
88 } | undefined
89 };
90}
91
92export function routerMiddleware(history: History): Middleware;
93
94export function createMatchSelector(path: string): (state: { router: RouterState }) => match | null;
95
96````
97
98### Additional Details
99 * Last updated: Thu, 07 Oct 2021 22:31:31 GMT
100 * Dependencies: [@types/redux](https://npmjs.com/package/@types/redux), [@types/history](https://npmjs.com/package/@types/history), [@types/react](https://npmjs.com/package/@types/react), [@types/react-router](https://npmjs.com/package/@types/react-router)
101 * Global values: none
102
103# Credits
104These definitions were written by [Huy Nguyen](https://github.com/huy-nguyen), [Shoya Tanaka](https://github.com/8398a7), and [Mykolas](https://github.com/mykolas).
105
\No newline at end of file