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
plugin-typescript not updating type checking on save in watch mode #186
Comments
I've found that if you change it back to the exact same text, it hits some cache in Rollup. Changing the code to something different but valid will fix the error, such as // src/app.ts
export function example(): number {
return 43;
} This might need a fix in Rollup because I can't figure out how to detect this as a plugin. @lukastaegert any thoughts? |
@lukastaegert Did you get a chance to look into this? @NotWoods needs some feedback to continue. The extension is mostly broken for me until this is addressed, and it is so near perfect :) |
Quick fix for now is to change the text of the file after fixing the type error, which updates the cache. |
The problem is that in case of error, the cache is not updated because no new cache object is created. Thus subsequent runs will use the outdated cache. This is a bug on Rollup side, but fixing it without completely disabling the cache in case of errors will require some thought. Essentially in case of errors, we still need to provide an updated cache. In the worst case we could attach it to the error object. |
Created rollup/rollup#3386 to track on Rollup side. |
Fix at rollup/rollup#3388 |
How Do We Reproduce?
create these files:
tsconfig.json
and run
rollup -cw
. It works, now change to and save:It works, now gives type error... great... BUT, change it back to the correct type and it stays giving the same type error! It never re-read the file properly. The terminal blinks showing that it did re-read the file, but it is stuck in a cache or some kind of bug.
Expected Behavior
In watch mode, when you update a file it re-reads it and gives the correct TypeScript compiler error if needed.
Actual Behavior
In watch mode, when you update a file it re-reads it and gives the wrong TypeScript compiler error that refers to the file before it was updated.
The text was updated successfully, but these errors were encountered: