salvoravida/redux-first-history

Problem with 'push' and 'replace' types

isjaki opened this issue · 1 comments

Seems like push and replace functions only accept location: LocationDescriptorObject<HistoryLocationState> as a parameter. In History interface they are overloaded, for example push function:

push(path: Path, state?: HistoryLocationState): void;
push(location: LocationDescriptorObject<HistoryLocationState>): void;

And then it is declared like this:

export declare const push: (...args: Parameters<History['push']>) => CallHistoryMethodAction<Parameters<History['push']>>;

But when declaring function parameters like this, only the last overload is used, hence I can't just pass a path string to the function but only a location object.

The problem was solved by updating history library from v4 to v5.