Skip to content

Conversation

a-tarasyuk
Copy link
Contributor

Fixes #1632

@a-tarasyuk a-tarasyuk force-pushed the fix/1632 branch 2 times, most recently from 798d12b to c5a62a9 Compare August 27, 2025 13:15
@a-tarasyuk a-tarasyuk marked this pull request as draft August 27, 2025 13:15
@a-tarasyuk a-tarasyuk force-pushed the fix/1632 branch 2 times, most recently from 441cca9 to ded3fa0 Compare August 27, 2025 18:42
@a-tarasyuk a-tarasyuk marked this pull request as ready for review August 27, 2025 19:59
@a-tarasyuk a-tarasyuk requested a review from jakebailey August 27, 2025 21:10
@a-tarasyuk a-tarasyuk requested a review from jakebailey August 29, 2025 12:16
Copy link
Member

@jakebailey jakebailey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, this seems probably right but will defer to @weswigham 😄

@jakebailey jakebailey requested a review from weswigham September 3, 2025 03:17
@a-tarasyuk
Copy link
Contributor Author

@jakebailey ok, thanks

Copy link
Member

@weswigham weswigham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was unsure if we wanted this behavior back and didn't just wanna make const enums always preserved, since that's what we were doing before we re-added inlining, but I suppose since vscode reported it, they'd like the runtime source elision behavior back, too. Tbh, preserveConstEnums should at least be the default nowadays, but that's a change for another PR.

We also need to elide namespace declarations containing exclusively const enums and/or types (preserveConstEnums dependent) for the same reasons you'd want the const enums elided. See the missing shouldEmitModuleDeclaration call from the original ts.ts source. ast.GetModuleInstanceState is already ported, so it shouldn't be too bad.

@a-tarasyuk a-tarasyuk requested a review from weswigham September 3, 2025 22:31
Copy link
Member

@weswigham weswigham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pretty good - some last comments on comment preservation, since we're working with NotEmittedStatements which explicitly exist to copy those.

@a-tarasyuk a-tarasyuk requested a review from weswigham September 4, 2025 20:47
@weswigham weswigham added this pull request to the merge queue Sep 16, 2025
Merged via the queue into microsoft:main with commit ea6d53c Sep 16, 2025
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Const enums shouldn't be emitted after inlining
4 participants