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
Add support for non-nullable properties #120
Comments
Furthermore, the fundamental proto message can still be null, it is just your particular domain that is claiming it never will be. It might be possible to fork this repo and implement the extension. At the moment, we don't have sufficient support for plugins |
As far as I am aware every message property in message A {
B test = 1;
}
message B {
string val = 1;
} Generates the following (I'm pasting only part of it) export class A extends jspb.Message {
hasValue(): boolean;
clearValue(): void;
getValue(): B | undefined;
setValue(value?: B): void;
// ...
} export namespace A {
export type AsObject = {
value?: B.AsObject,
}
} What's the deal with having The same goes for the |
@stefanorinetti All fields inside a message are optional actually. You can omit any of them and default value will be set. https://developers.google.com/protocol-buffers/docs/proto3#default But |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
gogoproto.nullable
annotation allow us to control property availabilityFor example the code
will generate TS
when
getTest()
actually will never returnundefined
. And it will require additional checks toundefined
in codebase whenstrictNullChecks
is enabled.So can we add a custom annotation which will generate TS code without
| undefined
part? Or please guide me how I can control this behaviour.The text was updated successfully, but these errors were encountered: