Why does linter error with "An argument for 'thisArg' was not provided"?
I'd like to use spread syntax in this code :
Math.min.apply( ...categories.map( cat => cat.category_id ) );
which shows the following lint error:
An argument for 'thisArg' was not provided
How to use spread syntax on a function that returns an array ?
3 answers

Don't use apply.
Math.min(...categories.map(c => c.category_id))

apply
takes context and the arguments in array. So use this,Math.min.apply(null, categories.map( cat => cat.category_id ) ));
But as
apply
doesnt use the context (see implementation here), you should simply use,Math.min(...categories.map( cat => cat.category_id ) ));

Your code is incorrect.
Function.apply
does except athis
argument first. For example:Math.min.apply(Math, ...categories.map(cat => cat.category_id));
The question here is to know if you actually needs to use apply or not.
All in all this is just a ''syntax'' error.