Docs Example (Persist API): Avoid 'any', avoid "might be null" error and make example clearer #1957
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.
Related Issues or Discussions
#1955
This is a small fix for one of the examples in the docs (persist API).

The example:
Link: https://docs.pmnd.rs/zustand/integrations/persisting-store-data#how-do-i-use-it-with-map-and-set
Fixes
Fixes TypeScript Error in this example and clarifies a certain type that isn't really any.
Summary
The type of
newValue
isn't exactlyStorageValue<any>
butStorageValue<YourStateType>
.This PR helps to clarify that and helps users have better types.
In addition,
str
ingetItem
could benull
and that's why this code won't compile.zustand
is incredible and I do not wish to waste your time, I just thought this might help 💛