template TSource param { Iterable < TSource > } source returns { Set < TSource > } export function toSet < TSource > ( source ) { const set = new Set < TSource > ( ) ; for ( const item of source ) { set . add ( item ) ; } return set ; }