Skip to content

Stale errors in watch mode #25068

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
andrewgreenh opened this issue Jun 19, 2018 · 5 comments
Closed

Stale errors in watch mode #25068

andrewgreenh opened this issue Jun 19, 2018 · 5 comments
Assignees
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue

Comments

@andrewgreenh
Copy link

andrewgreenh commented Jun 19, 2018

Hello everyone!
I'm not quite sure that this is really a bug or if I am missing a simple configuration option but I googled for 1.5 hours and came up with nothing:

TypeScript Version: 3.0.0-dev.20180619

Search Terms: Stale error, watch mode, saved file, closed file

Code

File a.ts:

import test from './b';

test(4, 5);

File b.ts:

function test(x: number, y: number) {
  return x + y / 5;
}

export default test;

tsconfig.json:

{
  "compilerOptions": {
    "module": "commonjs",
    "noEmit": true,
    "strict": true,
    "watch": true
  }
}

Expected behavior:
When running tsc on console, everything is fine. When one of the parameter types in b.ts is changed to string, the running compiler (in watch mode) should now show an error, becuase test is called with 2 numbers.

Actual behavior:
Errors only show up when compiler is restarted or when a.ts is saved.

Playground Link: https://github.com/andreasgruenh/typescript-watch

Related Issues: #21325 sounds similar but was fixed according to comments.

@mhegazy
Copy link
Contributor

mhegazy commented Jun 19, 2018

I am not seeing this on typescript@next. do you get the stale errors consistently? what version are you using?

@mhegazy mhegazy added Bug A bug in TypeScript Needs More Info The issue still hasn't been fully clarified labels Jun 19, 2018
@mhegazy mhegazy added this to the TypeScript 3.0 milestone Jun 19, 2018
@andrewgreenh
Copy link
Author

I'm using the version that was installed with @next this morning (as stated in the initial post). Don't know if this matters, but I'm on Windows 10 and it doesn't matter what program I use to save files (vscode/np++/notepad)

When I omit the noEmit flag, the files are getting updated, but the error is not.

@mhegazy
Copy link
Contributor

mhegazy commented Jun 19, 2018

I think there is something else going on.. here is what i am seeing...

screen

do you have other @types in your node_modules?

@andrewgreenh
Copy link
Author

This is really weird... This is what I'm seeing:
tsc-watch
Note that the timestamps in the watch output get updated.
You can also see, that the project is empty.

One addition: I addded ./node_modules/.bin to my path, so the tsc call from console starts the cli from inside node_modules

@andrewgreenh
Copy link
Author

andrewgreenh commented Jun 19, 2018

Oh wow, update: When updating the second parameter, it is working. When updating the first, it's not.

Ah nvm. It is not working on your site either. You only get the error from b.ts, but a.ts has an error, too, that is not beeing reported.
When updating the second parameter, there are errors in b.ts and a.ts (compiler only shows errors in b.ts). When updating the first one, there are only errors in a.ts (which are not shown)

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