Definitelytyped: Why react-router/history.d.ts ?

Created on 26 Sep 2016  路  4Comments  路  Source: DefinitelyTyped/DefinitelyTyped

  • [X] I want to talk about react-router/history.d.ts.

    • The authors of that type definition are cc/ @sergey-buturlakin @ngbrown

We have history/history.d.ts. Why isn't react-router using this?

This file was added by #6073, but history/history.d.ts predates that PR. I don't see a reason why it was duplicated.

Can we get rid of react-router/history.d.ts? Unfortunately the two files seem to have diverged, so this won't be easy. But they reference the same project, and have the same authors listed.

Most helpful comment

@remojansen You can't install the version of history that exists inside of react-router, hence this issue. Hopefully you can install @types/history and it will work.

All 4 comments

I'm not the author but this seems sensible. As an aside react-router will be undergoing big changes with regards history anyway; see here: https://github.com/ReactTraining/react-router/issues/3611#issuecomment-246739152

How can you install react-router/history via npm in TS 2.0? It used to be:

typings install react-router/history

but

npm install @types/react-router/history

is not a valid module name.

Thanks!

@remojansen You can't install the version of history that exists inside of react-router, hence this issue. Hopefully you can install @types/history and it will work.

This version of history is missing the type for hash on the Location type.

Was this page helpful?
0 / 5 - 0 ratings