Skip to content

tsc --watch recreates deleted source files #3277

@alexzorin

Description

@alexzorin

In current stable and also master (de88ede), tsc --watch will keep recreating file.js during recompilation even when the original file.ts source file is removed. Only workaround is to restart tsc --watch to make it forget about file.ts.

For example,

$ ls incorrect_recreation/
test2.ts  test.ts  tsconfig.json
$ cat tsconfig.json
<empty>
$ node bin/tsc.js --watch -p incorrect_recreation/
message TS6042: Compilation complete. Watching for file changes.

In another terminal:

$ ls
test2.js  test2.ts  test.js  test.ts  tsconfig.json # as expected
$ rm test.ts test.js 
$ ls
test2.js  test2.ts  tsconfig.json # so, no trace of test.js or test.ts now
$ touch test2.ts # force a recompile and wait
$ ls
test2.js  test2.ts  test.js  tsconfig.json # test.js should not have been recreated

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptFixedA PR has been merged for this issueHelp WantedYou can do this

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions