Skip to content

Commit

Permalink
Add setMap Field
Browse files Browse the repository at this point in the history
  • Loading branch information
nnnnoel committed Apr 25, 2022
1 parent 28f1ea7 commit f759c81
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions javascript/net/grpc/web/generator/grpc_generator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -885,16 +885,16 @@ void PrintProtoDtsMessage(Printer* printer, const Descriptor* desc,
"get$js_field_name$_asU8(): Uint8Array;\n"
"get$js_field_name$_asB64(): string;\n");
}
if (!field->is_map() && (field->type() != FieldDescriptor::TYPE_MESSAGE ||
field->is_repeated())) {
if (field->type() != FieldDescriptor::TYPE_MESSAGE || field->is_repeated()) {
printer->Print(vars,
"set$js_field_name$(value: $js_field_type$): "
"$class_name$;\n");
} else if (!field->is_map()) {
} else {
printer->Print(vars,
"set$js_field_name$(value?: $js_field_type$): "
"$class_name$;\n");
}

if (field->has_optional_keyword() ||
(field->type() == FieldDescriptor::TYPE_MESSAGE &&
!field->is_repeated() && !field->is_map())) {
Expand Down Expand Up @@ -938,6 +938,7 @@ void PrintProtoDtsMessage(Printer* printer, const Descriptor* desc,
"$class_name$.AsObject;\n"
"static toObject(includeInstance: boolean, msg: $class_name$): "
"$class_name$.AsObject;\n"
"static fromObject(msg: $class_name$.AsObject): $class_name$;\n"
"static serializeBinaryToWriter(message: $class_name$, writer: "
"jspb.BinaryWriter): void;\n"
"static deserializeBinary(bytes: Uint8Array): $class_name$;\n"
Expand Down

0 comments on commit f759c81

Please sign in to comment.