10

Closed

How to use the TypeScript compiler in the 'Watch output files' mode (tsc -w) on Windows?

description

The compiler version installed with the VS plugin doesn't have this option, but the version for node.js has. However I can't make this mode work on Windows. It creates empty files and doesn't compile anything. Is it a known bug? Can this be helped? I don't want to use heavy-weight VS, create a VS project and so on.
Closed Jan 4, 2013 at 10:51 PM by mhegazy
This should be fixed after change 9e096b74a8c6 to develop:
http://typescript.codeplex.com/SourceControl/changeset/9e096b74a8c6

comments

beholdr wrote Oct 5, 2012 at 6:25 PM

Have same issue on Windows 7 and Mac OS X.
TS detected changes in console:

Recompiling(Fri Oct 05 2012 21:22:06 GMT+0400 (MSK)): /usr/local/lib/node_modules/typescript/bin/lib.d.ts,/Users/user/Documents/typescript/script.ts

js file is created but has no content

jopamer wrote Oct 5, 2012 at 8:18 PM

Thanks! There are some known issues surrounding this feature, which is currently only available for Node. We're looking into it.

giggio wrote Oct 7, 2012 at 10:25 PM

Same problem here. Any idea when this is going to be available?

foglcz wrote Oct 24, 2012 at 1:04 PM

https://npmjs.org/package/tscw

Usage:

$ npm install -g tscw
$ tscw yourfile.ts
  • fixes the watch parameter by watching.
    Temporary & superfast workaround. I'll try to look into typescript source. We'll see.

seanhess wrote Nov 10, 2012 at 12:13 AM

I'm having the "no content" issue

thorn0 wrote Nov 23, 2012 at 11:38 AM

Tried 'watch mode' with 0.8.1. Still doesn't work.

D:\user\typescript>tsc1 --out file.js file.ts

D:\user\typescript>tsc1 -w --out file.js file.ts
Recompiling(Fri Nov 23 2012 13:29:47 GMT+0200 (Финляндия (зима))): C:/Users/user/AppData/Roaming/npm/node_modules/typescript/bin/lib.d.ts,D:/user/typescript/file.ts

C:\Users\user\AppData\Roaming\npm\node_modules\typescript\bin\tsc.js:24386
                throw err;
                      ^
TypeError: Cannot call method 'Close' of null
at TypeScriptCompiler.emit (C:\Users\user\AppData\Roaming\npm\node_modules\typescript\bin\tsc.js:23356:25)
at BatchCompiler.compile (C:\Users\user\AppData\Roaming\npm\node_modules\typescript\bin\tsc.js:24382:26)
at BatchCompiler.batchCompile (C:\Users\user\AppData\Roaming\npm\node_modules\typescript\bin\tsc.js:24661:27)
at IO.watchFiles.fileChanged (C:\Users\user\AppData\Roaming\npm\node_modules\typescript\bin\tsc.js:24021:25)
at Object.IO.watchFiles (C:\Users\user\AppData\Roaming\npm\node_modules\typescript\bin\tsc.js:24044:17)
at BatchCompiler.batchCompile (C:\Users\user\AppData\Roaming\npm\node_modules\typescript\bin\tsc.js:24653:29)
at Object.<anonymous> (C:\Users\user\AppData\Roaming\npm\node_modules\typescript\bin\tsc.js:24680:7)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:356:32)