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

Prefer use of Action or UnknownAction instead of AnyAction #4520

Merged
merged 12 commits into from
May 30, 2023

Conversation

EskiMojo14
Copy link
Contributor

@EskiMojo14 EskiMojo14 commented Apr 16, 2023


name: 🐛 Bug fix or new feature
about: Fixing a problem with Redux

PR Type

Does this PR add a new feature, or fix a bug?

Experiments with using Action and UnknownAction to avoid usage of AnyAction.

Why should this PR be included?

AnyAction introduces unwanted and unsafe any values into codebases.
UnknownAction allows accessing (and passing) arbitrary top level keys, but forces the reducer to check the value before use.
Action only allows access to the type property, until type guarded to allow extra properties. (safest, but most inconvenient)

Checklist

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Is there an existing issue for this PR?
  • Have the files been linted and formatted?
  • Have the docs been updated to match the changes in the PR?
  • Have the tests been updated to match the changes in the PR?
  • Have you run the tests locally to confirm they pass?

also includes changes from #4519 and #4491 to build upon

@codesandbox-ci
Copy link

codesandbox-ci bot commented Apr 16, 2023

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 61515da:

Sandbox Source
Vanilla Configuration
Vanilla Typescript Configuration

@netlify
Copy link

netlify bot commented Apr 16, 2023

Deploy Preview for redux-docs ready!

Name Link
🔨 Latest commit 8c0d688
🔍 Latest deploy log https://app.netlify.com/sites/redux-docs/deploys/6463596a8acfd80008f27370
😎 Deploy Preview https://deploy-preview-4520--redux-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@EskiMojo14 EskiMojo14 changed the title Encourage use of Action or UnknownAction instead of AnyAction Prefer use of Action or UnknownAction instead of AnyAction Apr 16, 2023
@EskiMojo14 EskiMojo14 marked this pull request as ready for review May 16, 2023 14:02
@markerikson markerikson merged commit 5a9d19b into reduxjs:master May 30, 2023
19 checks passed
@EskiMojo14 EskiMojo14 deleted the unknown-action branch May 30, 2023 15:43
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

2 participants