(
body:
| (() => Generator<Err<never, E>, Result<T, E>>)
| (() => AsyncGenerator<Err<never, E>, Result<T, E>>),
)
| 120 | InferErrTypes<YieldErr> | InferErrTypes<GeneratorReturnResult> |
| 121 | > |
| 122 | export function safeTry<T, E>( |
| 123 | body: |
| 124 | | (() => Generator<Err<never, E>, Result<T, E>>) |
| 125 | | (() => AsyncGenerator<Err<never, E>, Result<T, E>>), |
| 126 | ): Result<T, E> | ResultAsync<T, E> { |
| 127 | const n = body().next() |
| 128 | if (n instanceof Promise) { |
| 129 | return new ResultAsync(n.then((r) => r.value)) |
| 130 | } |
| 131 | return n.value |
| 132 | } |
| 133 | |
| 134 | interface IResult<T, E> { |
| 135 | /** |
searching dependent graphs…