mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-11 20:40:20 +00:00
react-router-redux typings update for createMatchSelector function
This commit is contained in:
Vendored
+4
@@ -2,6 +2,7 @@
|
||||
// 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.6
|
||||
|
||||
@@ -19,6 +20,7 @@ import {
|
||||
LocationDescriptor
|
||||
} from 'history';
|
||||
import * as React from 'react';
|
||||
import { match } from 'react-router';
|
||||
|
||||
export interface ConnectedRouterProps<State> {
|
||||
store?: Store<State>;
|
||||
@@ -77,3 +79,5 @@ export interface LocationChangeAction {
|
||||
}
|
||||
|
||||
export function routerMiddleware(history: History): Middleware;
|
||||
|
||||
export function createMatchSelector<State extends { router: RouterState }, Params>(path: string): (state: State) => match<Params> | null;
|
||||
|
||||
@@ -7,7 +7,7 @@ import { Provider } from 'react-redux';
|
||||
import createHistory from 'history/createBrowserHistory';
|
||||
import { Route } from 'react-router';
|
||||
|
||||
import { ConnectedRouter, routerReducer, routerMiddleware, push, RouterState } from 'react-router-redux';
|
||||
import { ConnectedRouter, routerReducer, routerMiddleware, push, RouterState, createMatchSelector } from 'react-router-redux';
|
||||
|
||||
// Create a history of your choosing (we're using a browser history in this case)
|
||||
const history = createHistory();
|
||||
@@ -44,3 +44,7 @@ ReactDOM.render(
|
||||
|
||||
// Now you can dispatch navigation actions from anywhere!
|
||||
store.dispatch(push('/foo'));
|
||||
|
||||
// And match location path using createMatchSelector
|
||||
const matchSelector = createMatchSelector('/:foo');
|
||||
const match = matchSelector(store.getState());
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"no-unnecessary-generics": false
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user