-
Notifications
You must be signed in to change notification settings - Fork 12.8k
LS#getEmitOutput misses constant enum values on second emit #1599
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
Comments
this is by design, as we do not track references to const enums. you will also run into the same issue with module properties: a.ts module m {
export var x = 0;
} var x = "global";
module m {
console.log(x); // m.x, and not global x.
} Now if you call getEmitOutput on a.ts, then b.ts then edit a.ts to remove the export for x, b.js still references an undefined m.x. This is ok if you do not rely on incremental build as the only build system. I think we need a proposal for this. |
@vladima should have a flag for this. |
"This is ok if you do not rely on incremental build as the only build system" I disagree. I don't think it's ever been 'by design' that Incremental Build produce different output than the normal build. It's not acceptable for our incremental approach to result in different code that can then be broken or be hard to track down. As such, i view this purely as a bug. We already aim for 100% correctness with Incremental Parsing, and we also aim for 100% correctness with --watch compilation. Incremental compile should be at that same bar as well. |
This issue should be resolved with 79272d7 - now regular enums are never inlined and always emitted as property access |
console.log(0 /*A*/);
)console.log(Foo.A);
). I can debug this into checker#getConstantValue which discovers the enum value but fails to find a proper node link. I guess this is because changing a.ts cleared some type caches)a.ts
b.ts
The text was updated successfully, but these errors were encountered: