-
Notifications
You must be signed in to change notification settings - Fork 70
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
Feature request: async version of map, andThen #33
Comments
This feature would be perfect! I know there is ts-async-results Lib but this lib is not used a lot and mainted by just one person. I would like to see this feature in this great lib, because there are a lot cases where you need async functions like encryption, webcalls, ... which would naturally produce a Result. |
@shalexbas I agree with you. We have been using ts-async-result in production extensively on https://www.chessroulette.live and it works perfectly, haven't encountered any issues yet. I think there's a thread here opened about merging ts-async-results into this library. |
Or someone could help me maintain it 😁! But yeah, we’ve been using it extensively at chessroulette so we will hopefully be able to put more resources into it as we grow. |
I was looking around for this, but I'm sad to find this open ticket that such does not exist. For now I'll continue with this pattern: async function anAsyncMethod(): Promise<Result<SomeType, SomeError>> {
const result = await someAsyncCall()
if (result.ok) {
return await someOtherAsyncCall()
}
return result
}
async function someAsyncCall(): Promise<Result<SomeType, SomeError>> {}
async function someOtherAsyncCall(): Promise<Result<SomeType, SomeError>> {} There's also scenarios where you may have to map the types as well. |
The text was updated successfully, but these errors were encountered: