Typescript filewatcher not working in JavaScript

2019-08-30 13:49发布

问题:

I have a typescript filewatcher set up in webstorm that I want to use to constantly compile changes to the typescript file. The file also uses jQuery. The typescript compiler is not changing the file to javascript as it should. The compilation happen perfectly fine until I added "--module amd" to the arguments - to compile with javascript. So what I have now is the new .ts file and the old .js file as it was before I changed the argument.

Here's the ts file:

/// <reference path="jquery.d.ts" />


function append(parentDivId, text){
    $(idSelector(parentDivId)).append(text);
}

Here are the filewatcher settings are as shown:

Program: C:\Users\Me\AppData\Roaming\npm\tsc.cmd

Arguments: --sourcemap $FileName$ --out "--module amd"

回答1:

If you want use tsc that comes with node the Program needs to be along the lines of node <pathtotsc.js>

Instead I recommend you use the TypeScript SDK. Demo : http://www.youtube.com/watch?v=RWXGMug_Rmo&hd=1



标签: WebStorm