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

Question: Types for generic wrapper saga function #685

Open
Ggayane opened this issue Mar 22, 2023 · 0 comments
Open

Question: Types for generic wrapper saga function #685

Ggayane opened this issue Mar 22, 2023 · 0 comments

Comments

@Ggayane
Copy link

Ggayane commented Mar 22, 2023

I have a generic wrapper function for saga error handling, which takes an effect as an argument. How can I convert this using typed-redux-saga?
The code before using typed-redux-saga:

export function* safe(
  effect: SimpleEffect<any>
): any {
  while (true) {
    try {
      return { response: yield effect };
    } catch (error: any) {
      return yield adaptError(error);
  }
}

the usage:

  const { response, error } = yield safe(call(loadStory, storyId));
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