Skip to content

Conversation

@Vuhag123
Copy link
Collaborator

@Vuhag123 Vuhag123 commented Oct 24, 2025

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

@sampajano sampajano requested a review from Copilot October 24, 2025 21:45
Copy link

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

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 AsObject parameter 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");

Copy link

Copilot AI Oct 24, 2025

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.

Suggested change

Copilot uses AI. Check for mistakes.
printer->Print(vars, "export class $class_name$ extends jspb.Message {\n");
printer->Indent();

printer->Print(vars, "constructor(opt_data?: $class_name$.AsObject);\n");
Copy link
Collaborator

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)?

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.

2 participants