Typing generator functions in Redux-Saga with Typescript with generic

Solution for Typing generator functions in Redux-Saga with Typescript with generic
is Given Below:

I’m trying to type my signIn worker saga and this answer has gotten me 90% of the way to the solution. My remaining issue is that the function I’m passing to yield call() is a generic and I’m not sure how to “forward” the types through to type my yield call():

1

As can be seen above, I’m not able to pass TResponseBody in post and so I get the unknown, which then conflicts with my CallEffect type.

function* signIn(
  action: PayloadAction<SignInFormValues>
): Generator<
  // step types
  CallEffect<HttpResponse<JSONResponse<LoginResponse>>> | PutEffect<AnyAction>,
  // return type
  void,
  // intermediate argument
  HttpResponse<JSONResponse<LoginResponse>>
> {
  const {
    payload: { username, password, returnUrl },
  } = action;

  try {
    // error here
    const response = yield call(post, 'http://localhost:5000/signin', {
      username: 'testUser',
      password: 'testPassword',
    });
    yield put(SIGN_IN_SUCCESS());
  } catch (error) {
    // handle error
  }
}

A simplified version of my post function:

async function post<TRequestBody, TResponseBody>(
  path: string,
  body: TRequestBody,
): Promise<HttpResponse<TResponseBody>> {
  return http<TResponseBody>(
    new Request(path, { method: 'post', body: JSON.stringify(body) })
  );
}

While I’m able to get around the compile error by using CallEffect<AnyAction> | PutEffect<AnyAction> as the first type parameter for Generator, I’d like to type it as correctly as possible.