param source param selector returns export const sumAsync = async < TSource > ( source , selector ) : Promise < number > => { let sum = 0 ; for ( const value of source ) { sum += await selector ( value ) ; } return sum ; } ;