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

Optional/undefined/null props in generated TS interfaces #1193

Open
mateuszgazdziak opened this issue Jul 23, 2022 · 1 comment
Open

Optional/undefined/null props in generated TS interfaces #1193

mateuszgazdziak opened this issue Jul 23, 2022 · 1 comment
Labels
priority: p3 Desirable enhancement or fix. May not be included in next release. type: question Request for information or clarification. Not an issue.

Comments

@mateuszgazdziak
Copy link

I wonder if there is any workaround for this issue:
protobufjs/protobuf.js#1171

Is there any way of getting rid of optionals in .ts code generated from gapic?

@mateuszgazdziak mateuszgazdziak added priority: p3 Desirable enhancement or fix. May not be included in next release. type: question Request for information or clarification. Not an issue. labels Jul 23, 2022
@alexander-fenster
Copy link
Contributor

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.

@alexander-fenster alexander-fenster self-assigned this Jul 29, 2022
@alexander-fenster alexander-fenster removed their assignment May 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p3 Desirable enhancement or fix. May not be included in next release. type: question Request for information or clarification. Not an issue.
Projects
None yet
Development

No branches or pull requests

2 participants