无法找到模块“react-vcode”的声明文件。“e:/atscloud-show-uide_modules/react-vcode/dist/index.js”隐式拥有 "any" 类型。
昨天想写一个验证码的功能,当安装并引入’react-vcode‘之后,出现了下面的错误提示:
无法找到模块“react-vcode”的声明文件。“e:/atscloud-show-uide_modules/react-vcode/dist/index.js”隐式拥有 "any" 类型。 Try npm install @types/react-vcodeif it exists or add a new declaration (.d.ts) file containing declare module 'react-vcode';ts(7016)
解决方案:
在项目根目录下新建一个declaration.d.ts文件,内容如下:
再引用就不会报错了: