import { IParallelEnumerable } from "../../types" ; import { nextIterationAsync } from "./_nextIterationAsync" ; import { typeDataToArray } from "./_typeDataToArray" ; param source param selector returns export const sumAsync = async < TSource > ( source , selector ) : Promise < number > => { const dataFunc = nextIterationAsync ( source , selector ) ; const values = await typeDataToArray ( dataFunc ) ; let sum = 0 ; for ( const value of values ) { sum += value ; } return sum ; } ;