Reputation: 28128
Typescript has a configuration option for auto compilation of typescript, as documented here.
{
"compileOnSave": true,
"compilerOptions": {
"noImplicitAny" : true
}
}
But simply including this in my tsconfig.json file is not enough to trigger auto compilation. I use MS Visual Studio Code as my IDE. How do I trigger the "compile on save" behavior?
Upvotes: 2
Views: 8272
Reputation: 1502
I had the same issue on my Atom IDE version - 1.34.0 running on windows 10 x64 system.
The issue was fixed after installing missing packages atom-ide-ui
and atom-typescript
.
Here is how my tsconfig.json file looks like.
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"sourceMap": true,
"outDir": "./build",
"rootDir": "./src",
"noImplicitAny": true
},
"compileOnSave": true
}
I have TypeScript version 3.2.4 installed globally.
Upvotes: 0
Reputation: 41
Try watch parameter at compilerOptions... It will be monitoring changes in your ts files and be automatically refresh in your js files. Example:
"compilerOptions": {
"module":"commonjs",
"noImplicitAny": true,
"removeComments": false,
"preserveConstEnums": true,
"outDir": "Scripts/javascript",
"watch": true,
"sourceMap": true
}
Upvotes: 4
Reputation: 5811
According to the TypeScript site:
"This feature is currently supported in Visual Studio 2015 with TypeScript 1.8.4 and above, and atom-typescript plugin."
So, it isn't supported by Visual Studio Code at this time. I use this option at work with Visual Studio 2015 and at home with Atom and it works fine. This is actually one of the reasons I switched from Visual Studio Code to Atom.
Upvotes: 4