const arrSort: number[] = arr.sort();
let minSum: number = 0;
arrSort.forEach((a, b) => {
if(b > 0){
minSum += minSum + a;
console.log(b)
}
})
console.log(minSum);
Even though 'minSum' is defined at the top, TypeScript still throws an error claiming it has not been assigned a value.