baml.future.any

Settle with the first future to SUCCEED; the remaining futures are then cancelled (JS `Promise.any`). If every future fails, throws `AllFailed<E>` carrying all the errors in input order. Cancelled inputs are skipped (they neither win nor contribute an error).

Reference version

Signature

function baml.future.any<T, Err>(
futures: baml.future.Future<T, Err>[]
) -> baml.future.Future<T, baml.future.AllFailed<Err>> throws never

Settle with the first future to SUCCEED; the remaining futures are then cancelled (JS Promise.any). If every future fails, throws AllFailed<E> carrying all the errors in input order. Cancelled inputs are skipped (they neither win nor contribute an error).

Source:<builtin>/baml/ns_future/future.bamlbytes 8729–11996