Allow more or less no. of arguments in Typescript functions
· ☕ 2 min read
Allow additional arguments or optional arguments for function calls in Typescript.
Consider the below example of a function that adds two numbers.
1 2 3 4 5 6 function getSum(i: number, j: number): number { return i + j; } console.log(getSum(1, 2)); // 3 This works fine and as expected, but what happens when there is a discrepancy in number of arguments.