Dealing with returning nulls for optional scalar or empty message fields #231
Unanswered
MarcPorciuncula
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Just started introducing
twirp-ts
withprotobuf-ts
to an existing codebase and we currently usenull
for empty values in our data types. Sinceprotobuf-ts
represents optional scalars and empty message fields asundefined
it's a little awkward implementing twirp servers as we have to map all our existing types to replace the nulls with undefineds before we return them.It seems like I could do it automatically with an interceptor but I would still get type errors providing our types where the protobuf-ts generated type is expected.
Is there anything we could do to make this easier and avoid having to manually map/change our existing types? Has anyone had a similar experience before?
Beta Was this translation helpful? Give feedback.
All reactions