Passing array as arguments in TypeScript
Arrays
I have two methods:
static m1(...args: any[]) { //using args as array ...}static m2(str: string, ...args: any[]){ //do something //.... //call to m1 m1(args);}
The call to m1(1,2,3) works as expect. However, the call m2("abc",1,2,3) will pass to m1([1,2,3]), not as expect: m1(1,2,3).
So, how to pass args as arguments when make call to m1 in m2?
Answer link : https://codehunter.cc/a/arrays/passing-array-as-arguments-in-typescript
Posted Apr 1, 2023, 7:00 PM UTC
10