当我使用以下的tsconfig.json
构建我的项目时,由于最近添加了strictNullChecks: true
,我遇到了错误。
{
"version": "2.3.4",
"compilerOptions": {
"allowSyntheticDefaultImports": false,
"removeComments": true,
"strictNullChecks": true,
"sourceMap": true,
"jsx": "react",
"target": "es5",
"lib": [
"es6",
"dom",
"scripthost"
],
"outDir": "../build/"
},
"include": [
"./*.ts",
"./*.tsx",
"./{client,mobile,server,shared,test,tools}/*.ts",
"./{client,mobile,server,shared,test,tools}/*.tsx",
"./{client,mobile,server,shared,test,tools}/**/*.ts",
"./{client,mobile,server,shared,test,tools}/**/*.tsx",
"./desktop/*.ts"
]
}
然而,在VSCode中我没有看到任何错误。
我还有以下的VSCode设置:
"typescript.tsdk": "./node_modules/typescript/lib",
除了 strictNullChecks 错误,似乎在 VSCode 中一切正常。
typescript: Go to project configuration
命令会发生什么?此外,在右下角状态栏中显示哪个typescript版本? - Matt Biernerinclude
字段时似乎可以工作... - Chet./**/*.ts
的通配符。 - Matt Bierner