-
Notifications
You must be signed in to change notification settings - Fork 793
Fix 1097 - typescript: add missing constructor definition in generated message classes. #1515
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: master
Are you sure you want to change the base?
Conversation
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.
Pull Request Overview
This PR addresses issue #1097 by adding a missing constructor definition to generated TypeScript message classes. The change ensures that generated .d.ts files include an explicit constructor signature for classes extending jspb.Message.
- Adds constructor definition with optional
AsObjectparameter to generated TypeScript declaration files
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| printer->Indent(); | ||
|
|
||
| printer->Print(vars, "constructor(opt_data?: $class_name$.AsObject);\n"); | ||
|
|
Copilot
AI
Oct 24, 2025
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.
Trailing whitespace on line 826 should be removed to maintain code cleanliness and comply with most style guides.
| printer->Print(vars, "export class $class_name$ extends jspb.Message {\n"); | ||
| printer->Indent(); | ||
|
|
||
| printer->Print(vars, "constructor(opt_data?: $class_name$.AsObject);\n"); |
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.
@Vuhag123 Thanks! for the change!
One request: Can you provide an example output in the PR description, and try verifying this change works (via a typescript example)?
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.
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.
Oh nice! This is great! Thanks for showing the change in action! This would be helpful indeed! Thanks Vuha :)
sampajano
left a comment
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.
Thanks so much for the change, @Vuhag123 ! :)


Fix (#1097) - typescript: add missing constructor definition in generated message classes.