-
-
Notifications
You must be signed in to change notification settings - Fork 119
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
fix(serializer/types): Allow null
value in serializer for parsers with default values
#769
Conversation
@MartinCura is attempting to deploy a commit to the 47ng Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, did you encounter errors with inferParserType
that required splitting it? It should handle both a single parser and records.
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
commit: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
Feel free to test the pkg.pr.new build to see if it works on your side. |
null
to serialize param whose parser has defaultnull
in serializer for parsers with default values
null
in serializer for parsers with default valuesnull
value in serializer for parsers with default values
The changelog is generated by semantic-release in the GitHub release when the package gets published. I think we can omit the docs, this is the expected behaviour. Thanks again for your contribution! 🙏 |
🎉 This PR is included in version 2.2.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
See related discussion.
Passing
null
to the serialize of a search param whose parser has a default currently is a type error, even though the behaviour works as expected.This is because for the values argument it infers the types using the same
inferParserType
which is fine for parsing but is not quite right for serializing. The way i'm fixing it is just declaring a differentinferSerializerRecordType
to be used here. If there's some TS-foo i don't know which allows reusing the sameinferParserRecordType
, that'd be even better!CONTRIBUTING.md
mentions "adding a minimal reproduction in the playground can be very helpful" but i couldn't immediately find how to create one there.Added some very basic tests, feel free to point out if any more would be nice.