template TSource param { Iterable < TSource > } source returns { TSource [ ] } export function toArray < TSource > ( source ) { const results = [ ] as TSource [ ] ; for ( const item of source ) { results . push ( item ) ; } return results ; }