Skip to content

Inferred dispatch type is not helpful #2896

@eduter

Description

@eduter

I was hoping that the AppDispatch from the examples would only accept the actions I defined, but it accepts basically anything.

Was that a design decision, a bug, a known limitation from the current type definition, a limitation from TypeScript itself?

I've created this repo to illustrate what I mean:
https://github.com/eduter/redux-toolkit-example

More specifically these lines:
https://github.com/eduter/redux-toolkit-example/blob/39b4e0d/src/features/counter/Counter.tsx#L48
https://github.com/eduter/redux-toolkit-example/blob/39b4e0d/src/features/counter/Counter.tsx#L26
https://github.com/eduter/redux-toolkit-example/blob/39b4e0d/src/features/counter/Counter.tsx#L34

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions