Visual Studio Code - TypeScript - not showing errors inline when tsconfig.json contains data

Viewed 2081

When I add an empty .tsconfig file (by empty i mean "{ }") Visual Studio code shows error inline and in the "problems" section. As soon as I add data to the tsconfig.json file, errors are no longer shown there. Do I need to set some specific setting that's set on default but not when you edit the tsconfig.json?

This is my 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
}

I already tried to remove "module": "commonjs" from the file as suggested here but this didn't work for me.

1 Answers

I played around with the tsconfig.json and came up with the following:

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

I am not sure why, but this solved my problem.

Related