Skip to content

Use regular enums for compatibility with TypeScript 5.9+#1507

Merged
sampajano merged 1 commit intogrpc:masterfrom
sampajano:fix.typescript.const.enum
Sep 11, 2025
Merged

Use regular enums for compatibility with TypeScript 5.9+#1507
sampajano merged 1 commit intogrpc:masterfrom
sampajano:fix.typescript.const.enum

Conversation

@sampajano
Copy link
Copy Markdown
Collaborator

@sampajano sampajano commented Sep 11, 2025

Updates TypeScript enum generation to use regular enum instead of const enum for compatibility with TypeScript 5.9+ which has verbatimModuleSyntax enabled by default.

This is a partial rollback of #1463 — Typescript 5.9+ has verbatimModuleSyntax by default, so #1463 no longer compiles by default.

@nnnnoel @SidStraw FYI :)

Fixes #1506

@sampajano sampajano requested a review from Copilot September 11, 2025 20:21
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Updates TypeScript enum generation to use regular enum instead of const enum for compatibility with TypeScript 5.9+ which has verbatimModuleSyntax enabled by default.

  • Replace const enum with enum in TypeScript declaration file generation
  • Add explanatory comments documenting the TypeScript compatibility rationale
  • Apply changes to both regular enums and oneof case enums

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link
Copy Markdown
Contributor

@nnnnoel nnnnoel left a comment

Choose a reason for hiding this comment

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

Thanks for mention, I forgot long times about my PR changes.
Looks fine and It has no breaking changes.

@sampajano
Copy link
Copy Markdown
Collaborator Author

@nnnnoel Thanks for taking a look and confirming! :)

@sampajano sampajano merged commit d951430 into grpc:master Sep 11, 2025
3 checks passed
@sampajano sampajano deleted the fix.typescript.const.enum branch September 11, 2025 22:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TypeScript const enum from proto prevents frontend import usage

3 participants