sua*_*kim 9 visual-studio-code typescript-typings checkjs
我正在一个 Electron 项目中使用checkjs: true
set in myjsconfig.json
并在ProjectRoot/typings/index.d.ts
.
我希望在所有 JS 文件中都可以使用这些类型。不幸的是,我必须手动引用它们:
如果没有手册参考,它将无法识别类型:
我的项目结构如下所示:
这是typings/index.d.ts的内容:
interface LauncherItem {
name: string,
icon: string,
cmd: string,
args: string,
}
interface AppConfig {
items: LauncherItem[],
appIconSize: number,
}
Run Code Online (Sandbox Code Playgroud)
和jsconfig.json:
{
"compilerOptions": {
"target": "es6",
"checkJs": true
},
"typeAcquisition": {
"include": [
"./typings/index.d.ts"
]
},
"include": [
"**/*.js",
"*.d.ts"
]
}
Run Code Online (Sandbox Code Playgroud)
不确定是否通常需要显式typeAcquisition
和包含*.d.ts
。它们只是我测试的结果,但显然不起作用......
归档时间: |
|
查看次数: |
675 次 |
最近记录: |