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

Cannot generate typescript types for message with multiple map fields #1717

Closed
steinybot opened this issue May 13, 2022 · 6 comments · Fixed by #1718
Closed

Cannot generate typescript types for message with multiple map fields #1717

steinybot opened this issue May 13, 2022 · 6 comments · Fixed by #1718

Comments

@steinybot
Copy link
Contributor

protobuf.js version: 6.11.2

Trying to use pbjs and then pbts with a message like:

message Message {
  int32 value = 1;
  map<string, bool> map_one = 2;
  map<string, bool> map_two = 3;
}

Fails with:

ERROR: Unable to parse /Users/jason/src/goodcover/core/e2e/proto/basic.proto.js: Identifier 'end2' has already been declared (9922:28)
@doerme
Copy link

doerme commented May 13, 2022

this worked for me

@steinybot
Copy link
Contributor Author

Sorry I must have oversimplified the example.

pbjs is generated a switch statement with two cases, one for each map field, and within that case it is redeclaring the variable end2. I'm not sure what exactly is complaining about the redeclaration but it is a pretty simple fix.

@steinybot
Copy link
Contributor Author

@doerme Oh I thought you were saying that my example works (before the fix). I just read your other comments and you were confirming that the fix works.

@doerme
Copy link

doerme commented Jun 13, 2022

in my case:
ERROR: Unable to parse /Users/liangxiaoming/Documents/friend/kaihei/packages/kaihei-proto/dist_proto/compiled.js: Identifier 'end2' has already been declared. (23932:44)

@hfisiteimprove
Copy link

Same here - the security update for v6.11.3 broke it.

@hfisiteimprove
Copy link

I speculate that some increment for "end2" is missing.

alexander-fenster added a commit that referenced this issue Jul 7, 2022
Co-authored-by: Alexander Fenster <fenster@google.com>
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 a pull request may close this issue.

3 participants