https://b.corp.google.com/issues/122673075
Should be null, however current behavior is returning undefined.
I'll fix that later.

On Thu, May 2, 2019 at 10:01 AM Hao Nguyen <h...@google.com> wrote:

> +Bo Yang <tebor...@google.com>  what should be the right behavior?
>
> On Thu, May 2, 2019 at 9:37 AM Hochhaus, Andy <ahochh...@samegoal.com>
> wrote:
>
>> Hello,
>>
>> We are converting our JS code from closure-library `goog.proto2` protocol
>> buffers to jspb. During our conversion we realized that unset singular
>> message fields return undefined. The confusing thing is that the generated
>> JSDoc getters state that only the message or null can be returned.
>>
>> /**
>>  * optional Msg msg = 1;
>>  * @return {?proto.test.Msg}
>>  */
>> proto.test.Example.prototype.getMsg = function() {
>>  return /** @type{?proto.test.Msg} */ (jspb.Message.getWrapperField(this,
>> proto.test.Msg, 1));
>> };
>>
>> I see a previously filed issue
>> <https://github.com/protocolbuffers/protobuf/issues/3842> about this.
>> I'm happy to submit a pull request fixing it once I understand the intended
>> functionality. Is the intent that undefined be returned (and the generated
>> JSDocs should be fixed) or that null should be returned as occurred in the
>> goog.proto2 API (and jspb.Message.getWrapperField() should be fixed).
>>
>> Best,
>> -Andy
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Protocol Buffers" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to protobuf+unsubscr...@googlegroups.com.
>> To post to this group, send email to protobuf@googlegroups.com.
>> Visit this group at https://groups.google.com/group/protobuf.
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.

Reply via email to