1、I declear one proto 3 file
syntax = "proto3";
import "google/protobuf/descriptor.proto";
extend google.protobuf.MessageOptions {
optional string my_option = 51234;
}
message Ext {
option (my_option) = "Hello world!";
}
2、And then I compile it, and use in google-protobuf runtime
import { Ext, myOption } from './ext_pb'
const ext = new Ext()
3、 And then, if I execute the following code
console.log(ext.getExtension(myOption))
I think it would output “Hello world!”, but it ouput “undefined”, why this happen;
4、If I execute the following code
ext.setExtension(myOption, 'se')
console.log(ext.getExtension(myOption))
It would output ‘se’ as my expected;