fix(types): Export Nullable
type for correctly inferring return type of createSerializer()
#801
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Bonsoir!* This PR fixes a type issue someone with my exact username 👀 introduced in #769, related to TypeScript.
It seems like TS has issues with inferring the type of the created serializer if it doesn't have access to the
Nullable
type, and I've been getting this very cryptic error:This PR solves this by simply exporting nuqs'
Nullable
type (for both client and server package entrypoints), if that's alright with you, andNullable
doesn't even have to be imported by app code to solve the TS issue.I'm not sure why TS can't manage without this explicit export and from some issues i've skimmed it shouldn't be the correct behaviour maybe, but the solution presented here is quite simple.
*I came across your website and realized we're quite close right now, as i'm currently staying in Lyon. Small world! 🌍