Description
Bug Report
π Search Terms
Typescript watch triggers multiple compilations
π Version & Regression Information
This changed when moving from Typescript version 4.8.4 to 4.9.3
Reviewed: #37994
β― Demonstration Video
Screen.Recording.2022-11-21.at.12.46.08.mov
π» Code
package.json
{
"name": "testtsc",
"version": "1.0.0",
"description": "Test double compilation of TypeScript files",
"main": "index.js",
"scripts": {
"test": "echo "Error: no test specified" && exit 1"
},
"author": "Elad Stern",
"license": "ISC",
"dependencies": {
"typescript": "^4.9.3"
}
}
main.ts
let a: string = "123456790123";
alert(a.slice(0, 2));
π Actual behavior
In terminal, invoking npx and then tsc main.ts --watch, changing the source code of main.ts triggers Typescript watch to compile the file again - not once, but twice. The same took place in larger projects - double compilation of changed files, with one or two seconds in between.
π Expected behavior
Once a source code file has been changed, it should compile only once by tsc watch, not twice.