Typescript react - Could not find a declaration file for module ''react-materialize'. 'path/to/module-name.js' implicitly has an any type

前端 未结 14 1165
鱼传尺愫
鱼传尺愫 2020-12-05 09:09

I am trying to import components from react-materialize as -

import {Navbar, NavItem} from \'react-materialize\';

But when the webpack is

14条回答
  •  执笔经年
    2020-12-05 09:48

    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.

提交回复
热议问题