public drawTextTest(p1: number, p2: number, p3: number):void {
console.log(p1, p2, p3);
}
let array = [2, 2, 5];
this.drawTextTest( ... array );
Run Code Online (Sandbox Code Playgroud)
我在编辑器中收到此错误
[ts]预期的#参数,但至少得到0.
使用spread运算符传递参数时,为什么TypeScript会出错?
当我实际运行代码时没有错误,扩展运算符只是让我使用数组作为函数的参数,但在VSCode中,它向我显示错误,就好像我不能.