Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ericmorand opened this issue Sep 1, 2024 · 0 comments

Comments

@ericmorand
Copy link

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>>?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant