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

Allow resolving raw promises #482

Open
forivall opened this issue Mar 18, 2021 · 0 comments
Open

Allow resolving raw promises #482

forivall opened this issue Mar 18, 2021 · 0 comments

Comments

@forivall
Copy link

forivall commented Mar 18, 2021

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 😛 )

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

No branches or pull requests

1 participant