Type Alias: AsyncResult<T, E>
AsyncResult<
T,E> =Promise<Result<T,E>>
Defined in: index.ts:52
Represents a Promise that resolves to a Result.
Type Parameters
T
T
Success value type
E
E
Error type
Example
ts
async function fetchUser(id: string): AsyncResult<User, Error> {
return Result.fromPromise(
async () => {
const response = await fetch(`/api/users/${id}`)
return response.json()
}
)
}