【发布时间】:2021-08-24 19:23:33
【问题描述】:
我开始将设计系统组件转换为 Typescript,但正在努力设置我们的 index.ts 文件。
我不断收到Could not find a declaration file for module xxx. Implicitly has 'any' type。
我们当前的文件结构是:
- index.ts
- components
- Button.tsx
- Input.jsx
- Icon.jsx
index.ts 文件如下所示:
export * from './components/Button' // no error
export * from './components/Input' // cannot find declaration
export * from './components/Icon' // cannot find declaration
请注意,我已经将 Button 转换为 .tsx,但要等到将来某个时候才能访问其他组件。
我已经为设计系统组件创建了一个全局.d.ts 文件,并且可以从应用程序的其他部分导入它们而不会出错,但是 index.ts 文件会发出声明文件错误。有什么想法吗?
【问题讨论】:
标签: typescript installation type-declaration