protobuf.js icon indicating copy to clipboard operation
protobuf.js copied to clipboard

Is it expected that `Message.create` returns instances of type `Message<Message<T>>`

Open ericmorand opened this issue 1 year ago • 0 comments

protobuf.js version: 7.4.4

I'm not sure I understand why Message.create si expected to return a Message of a Message of T.

Maybe I'm missing the point. I assume that a Message instance is the encodable representation of something - i.e. a reprosentation of something that can be passed to encode and is returned by decode.

Typically:

type Foo =  {
  x: number;
};

const message = namespace.lookupType('Foo').create({
  x: 5
}); // return a Message<Foo> that can be encoded

Is it correct? If so, why is the returned type Message<Message<Foo>>?

ericmorand avatar Sep 01 '24 09:09 ericmorand