salvoravida/redux-first-history

Support `history` 5 types

flying-sheep opened this issue · 2 comments

history 5.1 renamed the type LocationDescriptor to To. Since this project’s push and replace are typed like the following, their location argument is now typed as any. Current typing:

export declare const push: (location: import("history").LocationDescriptor<unknown>) => ReduxAction;

I think it can be fixed like this:

import { History, Location, Action } from 'history'
import { AnyAction as ReduxAction } from 'redux'

[...]

type To = Parameters<History['push']>[0]

declare const push: (to: To) => ReduxAction
[...]

works wonderfully! Thank you 😄