【发布时间】:2020-08-21 19:23:17
【问题描述】:
我下载了screeps typescript starter,并编写了代码。一切正常。然后我尝试将我的代码放在文件夹中(将“src/xx.ts”移动到“src/prototypes/xx.ts”)。 VSCode 开始抛出这样的错误:
“蠕变”类型上不存在属性“isRemoteRole”.ts(2339)
但是该属性是在 types.d.ts 中声明的。当我尝试使用 VScode 快速修复时,它会将属性声明添加到 index.d.ts 而不是 types.d.ts。这里有什么问题?
我尝试在 tsconfig 中明确指定类型文件的路径并重新启动 VSCode,但这似乎没有帮助。
我的 tsconfig.json:
{
"compilerOptions": {
"module": "esnext",
"lib": ["esnext"],
"target": "es2017",
"moduleResolution": "Node",
"outDir": "dist",
"baseUrl": "src/",
"sourceMap": true,
"strict": true,
"experimentalDecorators": true,
"noImplicitReturns": true,
"allowSyntheticDefaultImports": true,
"allowUnreachableCode": false
},
"exclude": ["node_modules"],
"types": ["src/types.d.ts"]
}
【问题讨论】:
标签: typescript visual-studio-code .d.ts