Reputation: 30175
I have started to use typescript in Visual Studio and it seems that the default behavior is to generate javascript even if the error is found. So really the only static compilation output I can see is the red underline if an error is detected. It is easy to overlook that really, so I would prefer if no js or some js that throws exception is generated in this case or some other form of explicit error. Is it possible to set up Visual Studio to do something like that?
Update: It seems there is an option to not emit on error, but that leaves the old js code, which is not a desired outcome, so I would like to hear about other simple options if they exist.
Upvotes: 2
Views: 405
Reputation: 31600
You can set the noEmmitOnError option to true in tsconfig.json.
eg.
{
"compilerOptions": {
"module": "commonjs",
"target": "es5",
"noImplicitAny": false,
"sourceMap": false,
"noEmitOnError": true
},
"exclude": [
"node_modules"
]
}
Upvotes: 3