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

oneof produces type with required fields #280

Open
ron23 opened this issue Apr 28, 2021 · 1 comment
Open

oneof produces type with required fields #280

ron23 opened this issue Apr 28, 2021 · 1 comment
Labels

Comments

@ron23
Copy link

ron23 commented Apr 28, 2021

proto3: when using oneof I expect to get a union of the various options. Right now all the fields are required.

// proto
message ABC {
  oneof something {
    string a = 1;
    string b = 2;
  }
// generated
export namespace ABC {
  export type AsObject = {
    a: string,
    b: string,
  }

I expected to get something like:

export namespace ABC {
    type A = {  a: string };
    type B = {  b: string };
    
    export type AsObject = A | B
@ron23 ron23 changed the title proto2 oneof doesn't create optional fields proto2 oneof produces type with required fields Apr 28, 2021
@ron23 ron23 changed the title proto2 oneof produces type with required fields oneof produces type with required fields Apr 28, 2021
@stale
Copy link

stale bot commented Apr 17, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Apr 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant