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

Move Redux module type extension into a separate imported file #321

Merged
merged 1 commit into from
Oct 23, 2021

Conversation

markerikson
Copy link
Contributor

This PR:

  • Extracts the "override the Redux core Dispatch type" declaration to a separate extend-redux.d.ts types file
  • Updates the files list to include that in the published package
  • Updates the typetests to compare compilation behavior without and with that extended module imported

Notes per commit:

We previously merged a PR that would globally override the types
from the Redux core package and patch the Dispatch type to
always assume that the thunk middleware is installed.

However, that assumption is not always true, and globally
overriding types is a dangerous approach to have as a default.

This commit moves the global overrides into a separate types file,
which can now be imported as 'redux-thunk/extend-redux'. This
allows users to still opt in to that behavior if desired.

The typetest files have been updated to compare the behavior with
and without importing the override file.

We previously merged a PR that would globally override the types
from the Redux core package and patch the `Dispatch` type to
_always_ assume that the thunk middleware is installed.

However, that assumption is not always true, and globally
overriding types is a dangerous approach to have as a default.

This commit moves the global overrides into a separate types file,
which can now be imported as 'redux-thunk/extend-redux'.  This
allows users to still opt in to that behavior if desired.

The typetest files have been updated to compare the behavior with
and without importing the override file.
@markerikson markerikson merged commit b79769c into master Oct 23, 2021
@markerikson markerikson deleted the feature/extract-override-types branch October 23, 2021 21:23
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.

None yet

1 participant