eslint: Use the rest parameters instead of 'arguments' (prefer-rest-params)

1,862 阅读1分钟

用Typescript写代码,用到了arguments,

function a(){
    console.log(arguments)
}

 eslint就给报了个警告:Use the rest parameters instead of 'arguments' (prefer-rest-params)。查了一下,正确的用法应该是下面这种写法:

function a(...args){
   console.log(args)
}