我正在尝试安装 react-input-search
。我有错误:
Could not find a declaration file for module 'react-search-input'. '.../app/node_modules/react-search-input/lib/index.js' implicitly has an 'any' type. Try
npm install @types/react-search-input
if it exists or add a new declaration (.d.ts) file containingdeclare module 'react-search-input';
ts(7016)
最佳答案
Typescript 应该与 Typescript NPM 包一起使用,Typescript NPM 包的名称上有前缀 @types/。 NPM 包 react-search-input 还没有对应的 Typescript 包,那么你可以通过以下简单修复
- 创建名称为 globals.d.ts 的文件并将其放入 Typescript watcher 文件夹的源根目录
- 在该文件上声明模块'react-search-input'
它应该工作正常
关于javascript - 错误 : "Could not find a declaration file for module ' react-search-input'",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56351599/