Open roboslone opened 2 years ago
UPD I've checked generated JS code and it seems that JS actually returns this
. TypeScript annotations have void
though.
/**
* @param {string} value
* @return {!proto.MyMessage} returns this
*/
proto.MyMessage.prototype.setSymbol = function(value) {
return jspb.Message.setProto3StringField(this, 1, value);
};
export class MyMessage extends jspb.Message {
setSymbol(value: string): void;
}
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
It's still relevant.
The fix should be relatively easy. The file to modify is here: https://github.com/improbable-eng/ts-protoc-gen/blob/master/src/ts/message.ts
Currently there's no way to chain setters, because they don't return anything. It would be convenient to have setters return the object they're called on: