Skip to content

Fix mixed sync/async callback results typings#31

Open
wiktor-obrebski wants to merge 2 commits into
masterfrom
fix/mixed-async-sync-map-callback
Open

Fix mixed sync/async callback results typings#31
wiktor-obrebski wants to merge 2 commits into
masterfrom
fix/mixed-async-sync-map-callback

Conversation

@wiktor-obrebski

Copy link
Copy Markdown
Owner

Fix bug in types when async and sync results has been mixed in map callback, e.g.

  const asyncFun = () => {
    return Promise.resolve(123 as const);
  };

  const mapped: Result<123, Error1 | Error2> = Result.combine(mixedResults)
    .map(() => {
      if (Math.random()) {
        return Err.of(new Error2());
      }

      return asyncFun();
    })

This gave a typescript error before this change.

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

Successfully merging this pull request may close these issues.

2 participants