Pass Rest parameter (ellipses dot) to another method in JS

48 views Asked by At

I need to customize some methods, for example rollbar has method for log error:

public error(...args: Rollbar.LogArgument[]): Rollbar.LogResult;


function myErrorLogger(...args){
   ...
   rollbar.error(args);
   //or 
   rollbar.error.apply(null, args);
}

but seems does not work right. and pass args as an array.

0

There are 0 answers