Skip to content
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

fix: use-readonly-types for oneof unions #706

Merged
merged 4 commits into from
Nov 15, 2022

Conversation

jonaskello
Copy link
Collaborator

This is a follow up PR to #691 that adds missing readonly modifiers for oneof fields when the oneof=unions option is active.

Previously it would generate code like this:

export interface Entity {
  readonly intVal: number;
  readonly stringVal: string;
  oneOfValue?: { $case: "theStringValue"; theStringValue: string } | {
    $case: "theIntValue";
    theIntValue: number;
  };
}

With this PR it now properly generates like this:

export interface Entity {
  readonly intVal: number;
  readonly stringVal: string;
  readonly oneOfValue?: { readonly $case: "theStringValue"; readonly theStringValue: string } | {
    readonly $case: "theIntValue";
    readonly theIntValue: number;
  };
}

Copy link
Owner

@stephenh stephenh left a comment

Choose a reason for hiding this comment

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

Thanks!

src/main.ts Outdated Show resolved Hide resolved
@jonaskello
Copy link
Collaborator Author

@stephenh Thanks for the collaborator status :-). Should I use "Squash and merge" when merging or what do you prefer?

@stephenh
Copy link
Owner

@jonaskello yep, I like squash and merge. Thanks!

@jonaskello jonaskello merged commit bc854ba into stephenh:main Nov 15, 2022
stephenh pushed a commit that referenced this pull request Nov 15, 2022
## [1.132.1](v1.132.0...v1.132.1) (2022-11-15)

### Bug Fixes

* use-readonly-types for oneof unions ([#706](#706)) ([bc854ba](bc854ba))
@stephenh
Copy link
Owner

🎉 This PR is included in version 1.132.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

stephenh added a commit to Focadecombate/ts-proto that referenced this pull request Nov 20, 2022
* main:
  chore(release): 1.132.1 [skip ci]
  fix: use-readonly-types for oneof unions (stephenh#706)
  chore(release): 1.132.0 [skip ci]
  feat: change channel options to client options in generate grpc/js (stephenh#704)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants