Skip to content

Commit

Permalink
Fix Protobuf .d.ts typings for .proto files without package
Browse files Browse the repository at this point in the history
Fixes grpc#939
  • Loading branch information
Yannic committed Aug 28, 2020
1 parent 0c56ed1 commit c7fcbba
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion javascript/net/grpc/web/grpc_generator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -367,11 +367,13 @@ string JSElementType(const FieldDescriptor *desc, const FileDescriptor *file) {

case FieldDescriptor::TYPE_ENUM:
if (desc->enum_type()->file() == file) {
// [for protobuf .d.ts files only] Do not add the module prefix for
// local messages.
string enum_name =
StripPrefixString(
desc->enum_type()->full_name(),
desc->enum_type()->file()->package());
return enum_name.substr(1);
return StripPrefixString(enum_name, ".");
}
return ModuleAlias(desc->enum_type()->file()->name())
+ StripPrefixString(
Expand Down

0 comments on commit c7fcbba

Please sign in to comment.