Skip to content

Incremental compilation does not catch type errors in deep imports #24986

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
horup opened this issue Jun 15, 2018 · 2 comments
Closed

Incremental compilation does not catch type errors in deep imports #24986

horup opened this issue Jun 15, 2018 · 2 comments
Assignees
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue

Comments

@horup
Copy link

horup commented Jun 15, 2018

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'.

@mhegazy
Copy link
Contributor

mhegazy commented Jun 19, 2018

looks like a duplicate of #25068

@mhegazy mhegazy added the Duplicate An existing issue was already created label Jun 19, 2018
@sheetalkamat
Copy link
Member

sheetalkamat commented Jun 20, 2018

@mhegazy this does not seem like duplicate of #25068. The issue here is when c.ts is changed the declaration emit for c.ts changes which results in emitting b.ts but since declaration emit for b.ts does not change, a.ts is not emitted/refreshed for new errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue
Projects
None yet
Development

No branches or pull requests

3 participants