redux-saga / redux-saga

An alternative side effect model for Redux apps

Home Page:https://redux-saga.js.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TS2345 error while putting thunk actions

qkudev opened this issue · comments

Steps to reproduce

Create any thunk action and try to put/putResolve it. Type checks will fail with error TS2345 because put and putResolve both expect to get plain object actions, not thunk actions.

Description of the bug/issue

put and putResolve both expect plain object actions, not thunk actions.

Create any thunk action and try to put/putResolve it. TypeScript compiler will break with error because put and putResolve are expected to get plain object action, not thunk action.

Steps to reproduce the bug/issue

  1. Create any thunk action
  2. Try to put or putResolve it in saga
  3. Get the TS error

But if use putResolve<any> the saga will work well.

Example

Checkout this example (makeStore.ts file)

Actual results

Getting the TS2345 error

The Expected results

Everything is ok with type checks

Environment information

redux-saga v1.2.3
@reduxjs/toolkit v1.9.3
typescript v4.4.2