I'm trying to integrate the Segment.io analytics snippet into a Typescript project.
Getting an ESLint error I can't work out. Here's the code:
analytics.factory = function (method: any) {
return function () {
const args = Array.prototype.slice.call(arguments)
args.unshift(method)
analytics.push(args)
return analytics
}
}
And the error is:
error Use the rest parameters instead of 'arguments' prefer-rest-params
My Typescript is a bit rusty, I've tried the following to no avail:
- Array.prototype.slice.call(this, ...arguments)
- Array.prototype.slice.call(null, ...arguments)
Any help much appreciated!
argumentskeyword:function (...args) {- VLAZ