import { CompareFunction } from '../types/types' ; export const sortArray = < T > ( compareFunction ) => ( arr ) : T [ ] => { const copy = [ ... arr ] ; copy . sort ( compareFunction ) ; return copy ; } ;