gpt4 book ai didi

typescript - Visual Studio Code - TypeScript - 当 tsconfig.json 包含数据时不显示内联错误

转载 作者:行者123 更新时间:2023-12-04 17:45:15 24 4
gpt4 key购买 nike

当我添加一个空的 .tsconfig 文件(空的意思是“{ }”)时,Visual Studio 代码显示错误内联和“问题”部分。一旦我将数据添加到 tsconfig.json 文件,那里就不再显示错误。我是否需要设置一些默认设置但在编辑 tsconfig.json 时不需要的特定设置?

这是我的 tsconfig.json:

{ 
"compilerOptions": {
"target": "es6",
"module": "commonjs",
"outDir": "dist",
"sourceMap": true,
"checkJs": true,
},
"files": [
"./node_modules/@types/mocha/index.d.ts",
"./node_modules/@types/node/index.d.ts",
],
"include": [
"src/**/*.ts"
],
"exclude": [
"node_modules"
],
"compileOnSave": true
}

我已经尝试按照建议从文件中删除 "module": "commonjs"here但这对我不起作用。

最佳答案

我尝试了 tsconfig.json 并得出了以下结论:

{ 
"compilerOptions": {
"target": "es6",
"module": "commonjs",
"sourceMap": true
},
"exclude": [
"node_modules"
],
"compileOnSave": true
}

我不确定为什么,但这解决了我的问题。

关于typescript - Visual Studio Code - TypeScript - 当 tsconfig.json 包含数据时不显示内联错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52442999/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com