agiledigital/typed-redux-saga

Allow resolving raw promises

Opened this issue · 0 comments

redux-saga allows just yielding a promise without a call effect, like

function* mySaga() {
  yield Promise.resolve()
}

although this example could be wrapped in a call, there are some obscure use cases for this.

I'd suggest, defining a resolve function/macro, which the macro transform just deletes. The typing would be like

export function resolve<P>(
  promise: P,
): SagaGenerator<P extends Promise<infer RT> ? RT : P, never>

if this would be a welcome change and i remember and/or the need becomes more pressing, i'll submit a PR. (yes i know i've said that before 😛 )