mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-06 16:20:26 +08:00
0997ad0603f96a5ca43b08f151061228094d431d
Using some of the redux-router action creators like pushState :
```
import { pushState } from 'redux-router';
export function saveEngagementAsVisibleSuccess(goTo) {
return function(dispatch) {
dispatch(pushState(null, goTo));
}
}
```
Throws the following error:
```
Error TS2349: Cannot invoke an expression whose type lacks a call signature.
```
The redux-router [source code](https://github.com/acdlite/redux-router/blob/master/src/actionCreators.js#L46-L63) declare those as functions not objects:
```
export function historyAPI(method) {
return (...args) => ({
type: HISTORY_API,
payload: {
method,
args
}
});
}
export const pushState = historyAPI('pushState');
export const push = historyAPI('push');
export const replaceState = historyAPI('replaceState');
export const replace = historyAPI('replace');
export const setState = historyAPI('setState');
export const go = historyAPI('go');
export const goBack = historyAPI('goBack');
export const goForward = historyAPI('goForward');
```
So I have update the types from `__ReduxRouter.ReduxRouterAction` to `__ReduxRouter.historyAPI`:
```
export const pushState: __ReduxRouter.historyAPI;
export const pushState: __ReduxRouter.historyAPI;
export const push: __ReduxRouter.historyAPI;
export const replaceState: __ReduxRouter.historyAPI;
export const replace: __ReduxRouter.historyAPI;
export const setState: __ReduxRouter.historyAPI;
export const go: __ReduxRouter.historyAPI;
export const goBack: __ReduxRouter.historyAPI;
export const goForward: __ReduxRouter.historyAPI;
```
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
DefinitelyTyped 
The repository for high quality TypeScript type definitions.
For more information see the definitelytyped.org website.
Usage
Include a line like this:
/// <reference path="jquery.d.ts" />
Contributions
DefinitelyTyped only works because of contributions by users like you!
Please see the contribution guide on how to contribute to DefinitelyTyped.
How to get the definitions
- Directly from the GitHub repos
- NuGet packages
- TypeScript Definition manager
List of definitions
- See CONTRIBUTORS.md
Requested definitions
Here is are the currently requested definitions.
License
This project is licensed under the MIT license.
Copyrights on the definition files are respective of each contributor listed at the beginning of each definition file.
Languages
TypeScript
100%