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

#2808 Preloaded state is now selectively partial (instead of deeply partial). #3485

Merged
merged 10 commits into from
Aug 12, 2019
Merged

#2808 Preloaded state is now selectively partial (instead of deeply partial). #3485

merged 10 commits into from
Aug 12, 2019

Conversation

Shakeskeyboarde
Copy link
Contributor

Fixes #2808 by using a specialized (but effectively NO-OP) type CombinedState to indicate that the Reducer returned by combineReducers() has a generic state type which should be considered shallowly partial.

NOTE: Requires Typescript >= 3.5 to work correctly.

@netlify
Copy link

netlify bot commented Jul 30, 2019

Deploy preview for redux-docs ready!

Built with commit fba87fe

https://deploy-preview-3485--redux-docs.netlify.com

index.d.ts Outdated Show resolved Hide resolved
Found a better way to type check CombinedState which allows the
$CombinedState symbol property marker to be optional. Since it's
optional, it's no longer necessary to strip it off in the Reducer state
parameter type and return type. This leaves the type definition for
Reducer unmodified, reduces the number of types required by one, and
makes the resolved types and stack traces clearer.
@Shakeskeyboarde Shakeskeyboarde changed the title Preloaded state is now selectively partial (instead of deeply partial). #2808 Preloaded state is now selectively partial (instead of deeply partial). Jul 30, 2019
@timdorr
Copy link
Member

timdorr commented Aug 2, 2019

It looks like we can get rid of DeepPartial as well. Since that would be a breaking change, can we at least remove it from the imports on the tests?

Leaving the definition in place as removing it would be a breaking change.
@Shakeskeyboarde
Copy link
Contributor Author

Unsure why prettier doesn't like docs/recipes/UsingObjectSpreadOperator.md... I didn't change it and prettier doesn't complain when I run it locally.

@Shakeskeyboarde
Copy link
Contributor Author

Ah, this branch was behind master, which had prettier formatting flaws in the UsingObjectSpreadOperator.md. Fixed the formatting and re-pushed.

@timdorr
Copy link
Member

timdorr commented Aug 10, 2019

@ChrisAckerman Do you want to resolve the conflicts here?

@Shakeskeyboarde
Copy link
Contributor Author

@timdorr Done.

@timdorr
Copy link
Member

timdorr commented Aug 12, 2019

Awesome, thanks!

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.

TypeScript: usage of DeepPartial for preloadedState is too deep
3 participants