1

I'm struggling to get Visual Studio Code to compile my TypeScript to Javascript. I've been successfully working with TS in Visual Studio 2017, however I thought I'd give VS Code a try.

I've got the watch task running, the last line in the terminal output is:

15:57:49 - Compilation complete. Watching for file changes.

However, when I save a ts file, nothing is happening. Again, in VS2017, it compiles on save fine.

There are areas of the project that produce a fair few TS errors - these are areas that have been written by others and are out of the scope of my project. I'm wondering if these errors would be stopping the compilation? Or should it still compile on a file-by-file basis?

ts.config

{
  "compilerOptions": {
    "noImplicitAny": false,
    "noEmitOnError": true,
    "removeComments": false,
    "sourceMap": true,
    "target": "es5"
  },
  "compileOnSave": true,
  "exclude": [
    "node_modules",
    "wwwroot",
    "typings/ckeditor/ckeditor.d.ts",
    "typings/ckeditor/index.d.ts",
    "typings/lodash/lodash.d.ts"
  ],
  "include": [
    "**/*.ts"
  ] 
}

Versions

VSCode 1.17.2

Typescript 2.5.3

7
  • do u face with an error? Commented Nov 1, 2017 at 16:07
  • @Salman Other than the linting errors from the other projects, nope. Commented Nov 1, 2017 at 16:10
  • so, how do u know they do not stop transpiling process? Commented Nov 1, 2017 at 16:12
  • @Salman I don't know if they're stopping them, that's part of my question :) However it seems strange that VS 2017 compiles them fine. Commented Nov 1, 2017 at 16:14
  • 1
    You defined "noEmitOnError": true so if you have typescript errors js won't be generated Commented Nov 1, 2017 at 16:23

1 Answer 1

2

"noEmitOnError": true compiler option prevents javascript generation in case typescript errors found.

More on compiler options here

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

Comments

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.