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

V2: Return zero values from ReflectMessage.get #813

Merged
merged 2 commits into from
Apr 26, 2024

Conversation

timostamm
Copy link
Member

This changes the behavior of ReflectMessage to never return undefined with get(). For unset fields, we return the zero value instead.

This simplifies call-sites, since they do not have to check for undefined anymore, even if the code path is guarded by a call to isSet().

Besides this change of behavior, this also adds JSDoc for ReflectMessage, ReflectList, ReflectMap, isFieldSet, and a few others.

packages/protobuf/src/reflect/reflect-types.ts Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants