Skip to content

Commit

Permalink
fix: Location type for History 5.x
Browse files Browse the repository at this point in the history
  • Loading branch information
salvoravida committed Jun 20, 2022
1 parent 328cf16 commit cd476b1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "redux-first-history",
"version": "5.0.10",
"version": "5.0.11",
"description": "Redux First History - Redux history binding support react-router - @reach/router - wouter",
"main": "build/es5/index.js",
"module": "build/es6/index.js",
Expand Down
24 changes: 12 additions & 12 deletions src/actions.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Location, Action, History } from 'history';
import { AnyAction as ReduxAction } from 'redux';
import type { Location, Action, History } from 'history';
import type { AnyAction as ReduxAction } from 'redux';

export const CALL_HISTORY_METHOD = '@@router/CALL_HISTORY_METHOD';
export const LOCATION_CHANGE = '@@router/LOCATION_CHANGE';
Expand All @@ -16,7 +16,7 @@ export type HistoryMethods =

export const locationChangeAction = (location: Location, action: Action) => ({
type: LOCATION_CHANGE,
payload: { location, action },
payload: { location, action } as { location: Location; action: Action },
});

function updateLocation<T extends HistoryMethods>(method: T) {
Expand All @@ -36,12 +36,12 @@ export const goForward: () => ReduxAction = updateLocation('goForward');
export const back: () => ReduxAction = updateLocation('back');
export const forward: () => ReduxAction = updateLocation('forward');

export type RouterActions =
ReturnType<typeof push> |
ReturnType<typeof replace> |
ReturnType<typeof go> |
ReturnType<typeof goBack> |
ReturnType<typeof goForward> |
ReturnType<typeof locationChangeAction> |
ReturnType<typeof back> |
ReturnType<typeof forward>;
export type RouterActions =
| ReturnType<typeof push>
| ReturnType<typeof replace>
| ReturnType<typeof go>
| ReturnType<typeof goBack>
| ReturnType<typeof goForward>
| ReturnType<typeof locationChangeAction>
| ReturnType<typeof back>
| ReturnType<typeof forward>;

0 comments on commit cd476b1

Please sign in to comment.