https://i.sstatic.net/b9Yz6.png Every time I implement the spread operator like demonstrated below
public outputTestData(p1: number, p2: number, p3: number):void {
console.log(p1, p2, p3);
}
let data = [2, 2, 5];
this.outputTestData( ... data );
An error message pops up in my editor saying:
[ts] Expected # arguments, but got a minimum of 0.
Why does TypeScript flag an error when utilizing the spread operator to pass arguments?
Oddly enough, there's no issue when the code is executed – the spread operator smoothly allows me to use the array as function arguments without any hitches. However, on VSCode, it highlights an error that seems unnecessary.