import { settleAll } from './settleAll' ; param { Promise < T > [ ] } promises returns export async function all < T > ( promises ) { const intermediateResults = await settleAll ( promises ) ; if ( intermediateResults . errors && intermediateResults . errors . length > 0 ) { const primaryError = intermediateResults . errors [ 0 ] ; if ( intermediateResults . errors . length > 1 && primaryError instanceof Error ) { primaryError . message = `${ primaryError . message }... and ${ intermediateResults . errors . length - 1 } other errors` ; ( primaryError as any ) . otherErrors = intermediateResults . errors . slice ( 1 ) ; } throw primaryError ; } return intermediateResults . results ; }