Skip to content

feat(proto-loader-gen-types): add options for specifying file extensions #2912

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

Merged
merged 4 commits into from
Mar 17, 2025

Conversation

tenkirin
Copy link
Contributor

@tenkirin tenkirin commented Mar 1, 2025

Add the following two options to proto-loader-gen-types:

  • targetFileExtension: File extension for generated files. Defaults to .ts
  • importFileExtension: File extension for import specifiers in generated code. Defaults to none (omitted)

The default behavior of proto-loader-gen-types is kept unchanged to avoid any possible breaking on existing usage, and the output is only modified when options are provided as needed.

Closes #2907

Copy link

linux-foundation-easycla bot commented Mar 1, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

@tenkirin
Copy link
Contributor Author

tenkirin commented Mar 4, 2025

@murgatroid99
Thanks for the suggestions! That’s a great point—I’ve committed an update.

Copy link
Member

@murgatroid99 murgatroid99 left a comment

Choose a reason for hiding this comment

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

Thank you for your contribution.

@murgatroid99 murgatroid99 merged commit 86aa0f2 into grpc:master Mar 17, 2025
4 of 5 checks passed
@tenkirin tenkirin deleted the feat/file-extension-options branch March 17, 2025 23:58
@simonhaenisch
Copy link

Nice to see this has landed, however it seems like a new version of @grpc/proto-loader hasn't been published yet? At least it's not working for me with --targetFileExtension='.d.ts'.

@murgatroid99
Copy link
Member

This is now out in version 0.7.14

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.

[Feature Request]: proto-loader-gen-types: More options for generated code
4 participants