【发布时间】:2020-07-20 15:34:21
【问题描述】:
我有一个 js 项目,我使用 vscode。对于类型检查,我使用//@ts-check。
一个依赖项thinky 没有类型信息,但我找到了@emtypes/thinky(github repo 已删除)。
在 vscode 中,我得到一个提示,我应该使用 declare module 'thinky' 创建一个 *.d.ts 文件。这样做会消除错误,但只是将thinky 定义为any,这没有帮助。
如何从 node_modules/@emtypes/thinky/index.d.ts 导入自定义类型?
search 展示了许多如何将 js 项目导入 ts 项目的示例,但我需要相反的方式。我还找到了Is it possible to use custom type definitions in an ES6 project?,但那是关于为 js 项目创建类型,我需要为导入的 js 库导入自定义 typings。
【问题讨论】:
标签: visual-studio-code typescript-typings