-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Generated class definitions don't implement their corresponding interfaces #824
Comments
In this context, |
It is, however Person does implement IPerson by way of having all the properties available, adding the explicit implements keyword would mean you can pass a Person to Person.encode() without having to resort to using type assertions: const writer = Person.encode(Person) instead of const writer = Person.encode(Person as IPerson) which does not provide type safety, as you can use Alternatively, the signature of encode could be changed to public static encode(message: messages.ISigned | message.Signed, writer?: $protobuf.Writer): $protobuf.Writer; |
Hmm, I didn't have any issues with providing a Person to encode yet, because it still satisfies the interface, even if it doesn't explicitly implement it - is this maybe related to specific compiler options? The difference there is that, on the interface most properties are optional, while on the class these are on the prototype and thus always present. |
Ah my apologies I was looking at the wrong thing for the issue, it's that messages with |
protobuf.js version: 5f2f177
Produces (some fields omitted)
Expected class definition:
The text was updated successfully, but these errors were encountered: