Description
It seems watch mode does not check for type errors induced by changes to types in deep imports.
A restart is required to catch these errors.
TypeScript Version:*
Version 3.0.0-dev.20180609 on Windows 10
Search Terms:
watch, incremental, deep
Code
Three files> a.ts, b.ts and c.ts + empty tsconfig.json file to please tsc.
// a.ts:
import {B} from './b';
let b = new B();
console.log(b.c.d);
// b.ts:
import {C} from './c';
export class B
{
c = new C();
}
// c.ts:
export class C
{
d = 1;
}
Expected behavior:
Running tsc --watch and making a type error in a.ts by inducing a change in c.ts should result in a type error in the console.
e.g. changing
d = 1;
to
d2 = 1;
should result in a type error in a.ts:
a.ts:3:17 - error TS2339: Property 'd' does not exist on type 'C'.
Actual behavior:
Running tsc --watch and making a type error in a.ts by inducing a change in c.ts does not result in a type error. Instead, the compiler happily writes:
Found 0 errors. Watching for file changes.
Restarting tsc in watch mode results in the expected type error:
a.ts:3:17 - error TS2339: Property 'd' does not exist on type 'C'.