Description
TypeScript Version: 3.1.1
Search Terms: tsc --watch
Code
// a.ts
declare module 'a' {
type foo = number;
}
// tsconfig.json
{}
Run tsc --watch --noEmit --project .
. Wait for typechecking to complete. cp a.ts b.ts
; wait for typechecking to complete again. then touch *
and wait for typechecking to run again. then rm b.ts
and wait for typechecking to complete again
Expected behavior:
Typechecking should succeed on the first run, should fail with 2 errors on the second run (error TS2300: Duplicate identifier 'foo'
) since a.ts and b.ts duplicate the same module; the third run should come up with the same results, and the 4th run should succeed.
Actual behavior:
The first run passes as expected, the second run only detects the error in b.ts
, the touch * causes the 3rd run to recognize both errors, and then deleting b.ts causes the 4th run to still think there's an error in a.ts
.
If I had to guess, tsc --watch is assuming in these file add / remove cases that adding or removing b.ts isn't going to change the type errors it finds in a.ts; this type of error is an example where that's clearly not the case.
Related Issues: couldn't find any