I have the exact same problem, and in my case npx tsx script
works but the IDE Typescript service throws the above error. I gave up trying to solve this, I don't think it's worth the time. Instead, a simple built-in alternative in JS is:
let arr = [1, 2, 3];
Math.max(...arr);