create-react-app icon indicating copy to clipboard operation
create-react-app copied to clipboard

Could not find a declaration file for module 'history'

Open AlexanderDowerk opened this issue 3 years ago • 7 comments

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';

AlexanderDowerk avatar Mar 10 '22 10:03 AlexanderDowerk

I'm having the same problem

idbd1 avatar Mar 17 '22 13:03 idbd1

Try to install this version npm i @types/[email protected]

ruslauz avatar Apr 28 '22 07:04 ruslauz

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?

nickyoung87 avatar Sep 06 '22 19:09 nickyoung87

@ruslauz solutions works for me as well.

SujitPrasaddKushwaha avatar Oct 28 '22 14:10 SujitPrasaddKushwaha

Try to install this version npm i @types/[email protected]

Worked for me, thanks!

bilalgoktas avatar Aug 22 '23 16:08 bilalgoktas