Skip to content

Does not match uppercasing of enum keys of protoc #25

@TLadd

Description

@TLadd

grpc_tools_node_protoc automatically uppercases enum keys, whereas grpc_tools_node_protoc_ts maintains whatever casing is in the proto file. The mismatch causes typescript errors when using the javascript enum correctly.

Example repo here: https://github.com/TLadd/example-grpc-enum.

Proto file: https://github.com/TLadd/example-grpc-enum/blob/master/helloworld.proto#L32

message HelloRequest {
  enum Value {
    hello = 0;
    hi = 1;
  }
  string name = 1;
  HelloRequest.Value value = 2;

Generated js: https://github.com/TLadd/example-grpc-enum/blob/master/helloworld_pb.js#L160

proto.helloworld.HelloRequest.Value = {
  HELLO: 0,
  HI: 1
};

Generated ts:
https://github.com/TLadd/example-grpc-enum/blob/master/helloworld_pb.d.ts#L33

    export enum Value {
    hello = 0,
    hi = 1,
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions