-
Notifications
You must be signed in to change notification settings - Fork 758
fix(2212): make enum constant inlining consistent with Strada behavior #2257
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
base: main
Are you sure you want to change the base?
Conversation
| - E[E["A"] = 0] = "A"; | ||
| + E[E["A"] = void 0] = "A"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, weird, what's going on here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is because this case uses the default reference resolver
typescript-go/internal/compiler/emitter.go
Lines 84 to 94 in 3fae7ba
| importElisionEnabled := !options.VerbatimModuleSyntax.IsTrue() && !ast.IsInJSFile(sourceFile.AsNode()) | |
| var emitResolver printer.EmitResolver | |
| var referenceResolver binder.ReferenceResolver | |
| if importElisionEnabled || options.GetJSXTransformEnabled() || !options.GetIsolatedModules() { // full emit resolver is needed for import ellision and const enum inlining | |
| emitResolver = host.GetEmitResolver() | |
| emitResolver.MarkLinkedReferencesRecursively(sourceFile) | |
| referenceResolver = emitResolver | |
| } else { | |
| referenceResolver = binder.NewReferenceResolver(options, binder.ReferenceResolverHooks{}) | |
| } |
|
Ah, I had forgotten about the runtime changes we made to make it easier to emit these without using the checker. How much of that actually has to go to fix the linked issue? Or is it just impossible to resolve? |
|
I think replicating the following from the checker ( typescript-go/internal/transformers/tstransforms/runtimesyntax.go Lines 1115 to 1139 in 3fae7ba
|
Fixes #2212