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

Why a repeated type in proto generated as ***sList in TS? Can it RESPECT the protobuf definition? #1257

Closed
uynap opened this issue Jul 5, 2022 · 1 comment

Comments

@uynap
Copy link

uynap commented Jul 5, 2022

If I have a proto definite like :

message Foo{
  repeated Goals goals = 1;

Then the plugin will give me something below:

export namespace Foo {
  export type AsObject = {
    goalsList: Array<Goals.AsObject>,
  }
}

But what I expect is goals: Array<Goals.AsObject> instead of goalsList: Array<Goals.AsObject>.
Is there a way to stop the plugin doing this "smart" thing?

@sampajano
Copy link
Collaborator

sampajano commented Jul 5, 2022

Thanks for the question :)

From what i understand, the TS generates does not define the API, but rather it generates the definitions matching the underlying generated code by the protobuf compiler.

Per documentation here: https://web.archive.org/web/20200928202524/https://developers.google.com/protocol-buffers/docs/reference/javascript-generated#any= (JS documentation is temporarily missing currently as mentioned here), the List suffix seems to be part of the protobuf API spec.

So sorry for the inconveniences but this is not fixable on grpc-web side :)

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

No branches or pull requests

2 participants