How to use arguments property from function in TS

Is it possible to use arguments from Function in TS or i have to use rest operator? Because when im trying to do this, im getting error:Expected 0 arguments, but got 4.ts(2554) JS Example
function sum() {
let result = 0;
for (let i = 0; i < arguments.length; i++) {
result += arguments[i];
}
return result;
}

console.log(sum(1, 2, 3, 4));
// Expected Output: 10
function sum() {
let result = 0;
for (let i = 0; i < arguments.length; i++) {
result += arguments[i];
}
return result;
}

console.log(sum(1, 2, 3, 4));
// Expected Output: 10
1 Reply
barry
barry2y ago
Afaik, not without errors, also why?
Want results from more Discord servers?
Add your server