facebook / create-react-app

Set up a modern web app by running one command.
https://create-react-app.dev
MIT License
102.54k stars 26.78k forks source link

Could not find a declaration file for module 'history' #12153

Open AlexanderDowerk opened 2 years ago

AlexanderDowerk commented 2 years ago

Windows 11 64bit

I just did a fresh install of this app and npm start threw the following error:

image

ERROR in src/index.tsx:4:38
TS7016: Could not find a declaration file for module 'history'. 'D:/Design und Development/epam react/my-app/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'
    2 | import ReactDOM from 'react-dom';
    3 | import { Router } from 'react-router-dom';
  > 4 | import { createBrowserHistory } from 'history';
      |                                      ^^^^^^^^^
    5 | import { ContextProvider } from '@epam/uui';
    6 | import { Snackbar, Modals } from '@epam/uui-components';
    7 | import { ErrorHandler } from '@epam/loveship';
dominikabieder commented 2 years ago

I'm having the same problem

ruslauz commented 2 years ago

Try to install this version npm i @types/history@4.7.11

nickyoung87 commented 2 years ago

I ran into this problem as well. Seems like @ruslauz's solution works for me. But that feels like a workaround right? Is there a better way to solve this for the long term?

SujitPrasaddKushwaha commented 1 year ago

@ruslauz solutions works for me as well.

bilalgoktas commented 1 year ago

Try to install this version npm i @types/history@4.7.11

Worked for me, thanks!

ibraheemosule commented 2 months ago

2024 and @ruslauz worked for me 😅 big up @ruslauz

nishila2 commented 1 month ago

I wish to upgrade this to the major release 5.0.0, How can I do then?