[英]Error: “Could not find a declaration file for module 'react-search-input'”
I am trying install react-input-search
. 我正在尝试安装
react-input-search
。 I have error: 我有错误:
Could not find a declaration file for module 'react-search-input'.
找不到模块'react-search-input'的声明文件。 '.../app/node_modules/react-search-input/lib/index.js' implicitly has an 'any' type.
'... / app / node_modules / react-search-input / lib / index.js'隐式具有'any'类型。 Try
npm install @types/react-search-input
if it exists or add a new declaration (.d.ts) file containingdeclare module 'react-search-input';
如果存在,请尝试
npm install @types/react-search-input
,或者添加一个包含declare module 'react-search-input';
的新声明(.d.ts)文件declare module 'react-search-input';
ts(7016)TS(7016)
Typescript should go with Typescript NPM package, the Typescript NPM package had prefix @types/ on it name. Typescript应该使用Typescript NPM包,Typescript NPM包在其名称上有前缀@ types / 。 The NPM package react-search-input do not had Typescript package for it yet, then you can simple fix by following
NPM包react-search-input还没有使用Typescript包,那么你可以通过以下方式进行简单的修复
And it should working fine 它应该工作正常
It's a typescript error. 这是打字稿错误。 It means that there is no type declarations in 'react-input-search' library.
这意味着'react-input-search'库中没有类型声明。 There is no package 'react-input-search' with types for it, so you need to declare usage of these library in your project by creating a file with extension
.d.ts
(for example libraries.d.ts
) and insert a line declare module 'react-search-input';
没有包含'react-input-search'的包类型,因此您需要通过创建扩展名为
.d.ts
的文件(例如libraries.d.ts
)来声明项目中这些库的用法并插入line declare module 'react-search-input';
into it. 进去。
You can always create the type definition library for this library react-search-input and put it on definitelytyped so now everyone including you can use it. 您始终可以为此库react-search-input创建类型定义库,并将其置于绝对状态,以便现在包括您在内的所有人都可以使用它。 Here is a guide with examples on how to create a type definition library.
这是一个指南 ,其中包含有关如何创建类型定义库的示例。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.