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

feat: Update fromPartial and fromJson to respect initializeFieldsAsUndefined #811

Merged
merged 3 commits into from
Mar 27, 2023
Merged

feat: Update fromPartial and fromJson to respect initializeFieldsAsUndefined #811

merged 3 commits into from
Mar 27, 2023

Conversation

stephenh
Copy link
Owner

No description provided.

@davidzeng0
Copy link
Contributor

davidzeng0 commented Mar 27, 2023

Seems like there's an issue with ts-poet where it generates ?? instead of a ? b : c
https://github.com/davidzeng0/ts-proto/blob/b5481ceb77f527e2d55725e4a685000b29c238c5/src/main.ts#L1895

Edit: nevermind

@davidzeng0
Copy link
Contributor

davidzeng0 commented Mar 27, 2023

Reproduced

Apparently I forgot I modified the parameters.txt in groups and my branch was older

@stephenh
Copy link
Owner Author

Thanks for fixing the build @davidzeng0 !

I'm thinking in retrospect, we're not exactly following the intent of initializeFieldsAsUndefined=false, which would be for those keys to not even be set in the first place; so your suggested fromPartialDefaultInitialize is technically more correct.

That said, the option proliferation in ts-proto is just kind of excessive :-D so at this point I prefer slightly less accurate semantics to another flag, and then if users end up complaining a lot about this in-exactness, we can always change it later.

Thank you!

@stephenh stephenh merged commit 1615ae0 into stephenh:main Mar 27, 2023
@davidzeng0 davidzeng0 deleted the partial2 branch March 27, 2023 15:20
@davidzeng0
Copy link
Contributor

No problem

stephenh pushed a commit that referenced this pull request Mar 27, 2023
# [1.145.0](v1.144.1...v1.145.0) (2023-03-27)

### Bug Fixes

* various fixes ([#812](#812)) ([ca18495](ca18495))

### Features

* Update fromPartial and fromJson to respect initializeFieldsAsUndefined ([#811](#811)) ([1615ae0](1615ae0))
@stephenh
Copy link
Owner Author

🎉 This PR is included in version 1.145.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants