Skip to content

Commit 3cd7e0d

Browse files
authored
Update ES6 .d.ts imports with comment about corresponding proto import path. (#1330)
#1313 updated the code generator to print a `proto import: "foo/bar.proto"` suffix for each import statement for the generated gRPC-web client code. This commit updates ensures the .d.ts file output by grpc-web contains the same type of comments.
1 parent 9cb8524 commit 3cd7e0d

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

javascript/net/grpc/web/generator/grpc_generator.cc

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -940,11 +940,12 @@ void PrintProtoDtsFile(Printer* printer, const FileDescriptor* file) {
940940
printer->Print("import * as jspb from 'google-protobuf'\n\n");
941941

942942
for (int i = 0; i < file->dependency_count(); i++) {
943-
const string& name = file->dependency(i)->name();
943+
const string& proto_filename = file->dependency(i)->name();
944944
// We need to give each cross-file import an alias.
945-
printer->Print("import * as $alias$ from '$dep_filename$_pb';\n", "alias",
946-
ModuleAlias(name), "dep_filename",
947-
GetRootPath(file->name(), name) + StripProto(name));
945+
printer->Print("import * as $alias$ from '$dep_filename$_pb'; // proto import: \"$proto_filename$\"\n",
946+
"alias", ModuleAlias(proto_filename),
947+
"dep_filename", GetRootPath(file->name(), proto_filename) + StripProto(proto_filename),
948+
"proto_filename", proto_filename);
948949
}
949950
printer->Print("\n\n");
950951

0 commit comments

Comments
 (0)