如何让VSCode向我显示strictNullChecks Typescript错误

时间:2017-06-30 20:04:04

标签: typescript visual-studio-code

当我使用以下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 中正常工作。

0 个答案:

没有答案