3

Microsoft fixed an issue with Typescript still generating JS compiled output in TS 2.0 even though the source file was deleted. What the solution involved was using file watchers to trigger deletion callback event and removing the tsc watch file from the source file list.

Is there a reason we can't also delete the target output files when a source file is deleted? This creates issues when you are refactoring as functions / JS types collide and create crashes.

Wouldn't it seem trivial to add a tsconfig compiler option to also delete targets (.js.map, .js) so that tsc -watch will not require user to continuously stop/start or use gulp to clean the output directory? You could easily use a glob pattern to identify target outputs.

SliverNinja - MSFT
  • 31,051
  • 11
  • 110
  • 173

1 Answers1

1

You could easily use a glob pattern to identify target outputs

You can. But its easier to simply use outDir and blow away at the outDir to clear old files.

basarat
  • 261,912
  • 58
  • 460
  • 511
  • this approach requires manual intervention, when refactoring current branch or switching branches for collaboration this could be automated to reduce the manual `gulp clean` step. Just curious if we can bring this change forward with the `tsc` tooling. – SliverNinja - MSFT May 25 '17 at 03:49
  • `tsc -w` was never intended to accomodate all use cases. You mostly use `webpack -w` or `watchify` or gulp or whatever else strikes your fancy and TSC will work with that seamlessly – basarat May 25 '17 at 04:51