3

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.

4
  • 1
    Remove files, wrong usage there and the typings are checked automatically in @types Commented Sep 21, 2018 at 11:43
  • @Marv I removed files but the errors are still not highlighted. Commented Sep 21, 2018 at 11:59
  • try renaming to tsconfig.json, might be the default one vscode looks for. And whenever doing a change, reload the vscode window Commented Sep 21, 2018 at 12:06
  • The file is already named tsconfig.json. Reloading after a change doesn't seem to help me either. Commented Sep 21, 2018 at 12:14

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

In a similar situation, changing "target": from "es5" to "es6" helped. Of course that wasn't the case here, your original config already had "target": "es6".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.