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

前端 未结 14 1158
鱼传尺愫
鱼传尺愫 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 10:01

    try adding to tsconfig.json file: "noImplicitAny": false worked for me

    0 讨论(0)
  • 2020-12-05 10:03

    What I did was run the following commands from nodejs command prompt while in the project folder directory:

    1. npm init
    2. npm install -g webpack
    3. npm install --save react react-dom @types/react @types/react-dom
    4. npm install --save-dev typescript awesome-typescript-loader source-map-loader
    5. npm install ajv@^6.0.0
    6. npm i react-html-id
    7. import the package(in node modules) in App.js file by adding the code: import UniqueId from 'react-html-id';

    I did the above(although I already had npm installed) and it worked!

    0 讨论(0)
提交回复
热议问题