Closed DRL9 closed 3 years ago
Versions of relevant software used google-protobuf: 3.17.3 ts-protoc-gen: 0.15.0
google-protobuf
3.17.3
ts-protoc-gen
0.15.0
What happened .d.ts file setXX() and addXXs() return type are wrong
setXX()
addXXs()
What you expected to happen That method should return this replace void
this
void
How to reproduce it (as minimally and precisely as possible):
syntax = "proto3"; package pd; message Test { string a_string = 1; repeated string a_array = 2; }
output js code segment
/** * @param {string} value * @return {!proto.pd.Test} returns this */ proto.pd.Test.prototype.setAString = function(value) { return jspb.Message.setProto3StringField(this, 1, value); }; /** * @param {!Array<string>} value * @return {!proto.pd.Test} returns this */ proto.pd.Test.prototype.setAArrayList = function(value) { return jspb.Message.setField(this, 2, value || []); }; /** * @param {string} value * @param {number=} opt_index * @return {!proto.pd.Test} returns this */ proto.pd.Test.prototype.addAArray = function(value, opt_index) { return jspb.Message.addToRepeatedField(this, 2, value, opt_index); };
output .d.ts segment
setAString(value: string): void; setAArrayList(value: Array<string>): void; addAArray(value: string, index?: number): string;
google-protobuf marked the return type of these method as this. However, output'ssetX() return void, and addXX() return the inputValue's type.
setX()
addXX()
I expect to generate the following code:
setAString(value: string): this; setAArrayList(value: Array<string>): this; addAArray(value: string, index?: number): this;
duplicated #218
Versions of relevant software used
google-protobuf
:3.17.3
ts-protoc-gen
:0.15.0
What happened .d.ts file
setXX()
andaddXXs()
return type are wrongWhat you expected to happen That method should return
this
replacevoid
How to reproduce it (as minimally and precisely as possible):
output js code segment
output .d.ts segment
google-protobuf
marked the return type of these method asthis
. However, output'ssetX()
return void, andaddXX()
return the inputValue's type.I expect to generate the following code: