import { ErrorString , InvalidOperationException } from "../../shared" ; param source param predicate throws returns export const lastAsync = async < TSource > ( source , predicate ) : Promise < TSource > => { let last = null ; for await ( const value of source ) { if ( await predicate ( value ) === true ) { last = value ; } } if ( ! last ) { throw new InvalidOperationException ( ErrorString . NoMatch ) ; } return last ; } ;