Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Did TS declaration file disappear for v4? #937

Closed
bmueller-sykes opened this issue Feb 11, 2022 · 4 comments
Closed

Did TS declaration file disappear for v4? #937

bmueller-sykes opened this issue Feb 11, 2022 · 4 comments

Comments

@bmueller-sykes
Copy link

Apologies if this is not the right place for this. As of a couple of days ago, I cannot get my TS-based React project to start in dev mode. I'm running v4.10.1 at present, and cannot upgrade to v5 (I still rely on basename for some parts of my code, and cannot easily refactor those parts yet. Someday...).

When I run npm start I get the following error:

Could not find a declaration file for module 'history'. '/path/to/project/node_modules/history/index.js' implicitly has an 'any' type.
If the 'history' package actually exposes this module, consider sending a pull request to amend 'https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/history'

1 | import { useHistory } from 'react-router-dom';
2 | import { createBrowserHistory } from 'history';

Any guidance is appreciated. Thanks!

@Beraliv
Copy link

Beraliv commented Feb 16, 2022

Same story for us

We cannot upgrade to v5, but still need type definitions for v4

@mcansh
Copy link
Contributor

mcansh commented Feb 16, 2022

type definitions for versions prior to v5 are available via DefinitelyTyped (just make sure to use the v4 version of the types)

@Beraliv
Copy link

Beraliv commented Feb 16, 2022

Okay, thank you for the quick answer!

Worked for us

@bmueller-sykes
Copy link
Author

Yeah, that worked for me as well, it would appear. I looked for that type file, but couldn't find it initially for some reason, but adding this to my devDependencies in package.json:

`"@types/history": "4.7.11",

...did the trick

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants