FormidableLabs / redux-little-router

A tiny router for Redux that lets the URL do the talking.
MIT License
1.04k stars 113 forks source link

TypeScript: Redundant confliting definition of History interface #288

Closed Viniter closed 5 years ago

Viniter commented 6 years ago

The TypeScript definitions contain a definition of History interface that's not compatible with the one provided by history library.

https://github.com/FormidableLabs/redux-little-router/blob/57a15dbcd88daa95af8f5ad5677e691583b7e5ff/index.d.ts#L126

This causes a typing issue when for example trying to pass custom history to routerForBrowser(). You could instead import the interface from history and ditch the above mentioned definition.

Viniter commented 6 years ago

Correction: history doesn't actually provide TS definitions, it's provided by DefinitelyTyped (@types/history). It would have to be added as a dependency in order to be used.

Alternatively, the current definition can be updated to match the @types/history one. I can open PR with either one of the fixes. Just tell me which one would you prefer.

EDIT: After looking into it for a bit, the difference between definitions is actually pretty slight, the only thing that needs fixing is the Action type the interface uses. I'll open a PR that fixes it, but you still might consider adding the type dependency, to save yourself the trouble.

parkerziegler commented 5 years ago

Thanks @Viniter! Appreciate you taking the time to look into those definitions. Just reviewed your PR, testing locally now. Apologies for the late response, we have only so many hands on OSS at once!

parkerziegler commented 5 years ago

Fixed by #289.