Files
DefinitelyTyped/types/react-router-redux/index.d.ts
Thomas Charlat 65b176eaef [react-redux]: decoration target props should not extend injected props, contravariance issue (#25228)
* feat(react-redux): add strict null check

* feat(react-redux): remove improper inference tests

Infered decorated typings would rely on the implicit and false
assumption that decorated component props extend injected props and
own props

#24922
#24913

* fix(react-redux): injected props and decorated component props intersection

* InjectedProps should not have to extend DecoratedProps
* DecoratedProps should not have to extend InjectedProps
* DecoratedProps should extend Intersection<InjectedProps, DecoratedProps>
* Remaining Props should be required on the decoration output

#24913
#24922

* feat(react-redux): add new commiters

* feat(react-redux): 2.9 keyof compatibility depends on Extract (2.8)
2018-05-07 12:34:04 -07:00

84 lines
2.2 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>
// Shoya Tanaka <https://github.com/8398a7>
// Mykolas <https://github.com/mykolas>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
import {
Store,
Dispatch,
Middleware,
Reducer
} from 'redux';
import {
History,
Location,
Path,
LocationState,
LocationDescriptor
} from 'history';
import * as React from 'react';
import { match } from 'react-router';
export interface ConnectedRouterProps<State> {
store?: Store<State>;
history: History;
}
export class ConnectedRouter<State> extends React.Component<ConnectedRouterProps<State>> {}
export const LOCATION_CHANGE = '@@router/LOCATION_CHANGE';
export interface RouterState {
location: Location | null;
}
export const routerReducer: Reducer<RouterState>;
export const CALL_HISTORY_METHOD = '@@router/CALL_HISTORY_METHOD';
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 routerActions: {
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 {
type: typeof CALL_HISTORY_METHOD;
payload: LocationActionPayload;
}
export interface LocationChangeAction {
type: typeof LOCATION_CHANGE;
payload: Location & {
props?: {
match: {
path: string;
url: string;
params: any;
isExact: boolean;
},
location: Location;
history: History;
}
};
}
export function routerMiddleware(history: History): Middleware;
export function createMatchSelector(path: string): (state: { router: RouterState }) => match<{}> | null;