protobuf.js
protobuf.js copied to clipboard
Incorrect typings generated by pbts
protobuf.js version: 6.9.0 suppose I have the following proto file
message MessageA {
MessageB message = 1;
}
message MessageB {
oneof inner {
string str1 = 1;
string str2 = 2;
}
}
The generated typescript definition looks like this
export class MessageA implements IMessageA {
/* omitted irrelevant stuff */
public message?: (IMessageB|null);
}
but this is WRONG. message actually still has the toJSON method and 'inner' field, etc. so it should be typed as following, right?:
export class MessageA implements IMessageA {
/* omitted irrelevant stuff */
public message?: (MessageB|null);
}
is there a way we could setup a test to demonstrate this is what happens? maybe something that creates an instance of MessageA and then checks for the presence of messageA.message.toJSON
We are running into the same issue. The properties on the class instance are of type class MessageB and not of (plain) object IMessageB.