I am trying to import components from react-materialize as -
import {Navbar, NavItem} from 'react-materialize';
But when the webpack is compining my .tsx
it throws an error for the above as -
ERROR in ./src/common/navbar.tsx
(3,31): error TS7016: Could not find a declaration file for module 'react-materi
alize'. 'D:\Private\Works\Typescript\QuickReact\node_modules\react-materialize\l
ib\index.js' implicitly has an 'any' type.
Any resolution for this .I'm unsure how to resolve this import statement to work with ts-loader
and webpack.
The index.js
of react-materialize looks likes this . But how to resolve this for the module import in my own files ..
https://github.com/react-materialize/react-materialize/blob/master/src/index.js
I had a similar error but for me it was react-router
. Solved it by installing types for it.
npm install --save @types/react-router
Error:
(6,30): error TS7016: Could not find a declaration file for module 'react-router'. '\node_modules\react-router\index.js' implicitly has an 'any' type.
If you would like to disable it site wide you can instead edit tsconfig.json
and set noImplicitAny
to false
.