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

Error of protoc compiles FieldOption when using a enum from other proto #299

Open
hantien opened this issue Apr 15, 2022 · 0 comments
Open

Comments

@hantien
Copy link

hantien commented Apr 15, 2022

Versions of relevant software used
ts-protoc-gen: 0.15.0

What happened
Encountered error when protoc compiles typescripts for FieldOption and the proto uses an enum from the other proto.

Example:

example_field_option.proto

extend google.protobuf.FieldOptions {
Req req = 2000;
}

This would fail if Req (enum) is from another proto (ex: my_enum.proto)
Error: export const requirement: jspb.ExtensionFieldInfo<api_protos_my_enum_mask_pb.Req>;
However, api_protos_my_enum_mask_pb.Req is considered as a value
It should use ReqMap instead.

If the enum is in the same proto, the protoc generates the right stub without errors.

What you expected to happen

Support importing enums from other files for field_option use case.

How to reproduce it (as minimally and precisely as possible):

  1. Create a proto (a.proto) with a FieldOption
  2. Create another proto (b.proto) with an enum
  3. Import the enum from b.proto to a.proto and use in the FieldOption
  4. Run protoc to generate typescript for a.proto
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

1 participant