已安装xxx模块,但报错无法找到模块“xxx”的声明文件

已声明“Carousel”,但从未读取其值。ts(6133)
无法找到模块“teaset”的声明文件。“g:/project/carrotdaily/node_modules/teaset/index.js”隐式拥有 "any" 类型。
尝试 `npm install @types/teaset` (如果存在),或者添加一个包含 `declare module 'teaset';` 的新声明(.d.ts)文件ts(7016)

在根目录新建文件 legacy.d.ts

文件内容写上以下声明:

declare module 'teaset';

这样就不会报错了

原文地址:https://www.cnblogs.com/unclefang/p/13840119.html