gapic-generator-typescript
gapic-generator-typescript copied to clipboard
Optional/undefined/null props in generated TS interfaces
I wonder if there is any workaround for this issue: https://github.com/protobufjs/protobuf.js/issues/1171
Is there any way of getting rid of optionals in .ts code generated from gapic?
We post-process the generated .d.ts files (this script) so technically we can do whatever we want. Dropping optionals altogether is a scary thing, it will most likely break a lot of users' code. This is one of the things that makes our generated libraries imperfect, and at this moment I don't see an easy solution here (especially given that all proto3 fields are indeed optional and can be omitted).
Maybe, if we could make the discussion more constructive, could you share a code sample with GAPIC where the fact that we accept and return an interface with optionals makes the code harder to write? We'll look at that specific example then and see if there is any way to improve the experience.