regexFind: /\.\.\.([a-zA-Z_$][a-zA-Z0-9_$.-]*):\s*(\w+)\[\]\s*=\s*\[.*\]/
regexReplace: ...$1: $2[]Remove initializer from rest parameter. Rest parameters cannot have default values or initializers - they collect remaining arguments and are always optional.
- function testRestInitializer(...args: string[] = ['default']) {
+ function testRestInitializer(...args: string[]) {
return args
}Explanation: Remove initializer from rest parameter
- const process = (...items: number[] = [1, 2, 3]) => items
+ const process = (...items: number[]) => itemsExplanation: Remove initializer from rest parameter in arrow function
npx tsc ./docs/1048/index.ts --noEmit --prettydocs/1048/index.ts:1:33 - error TS1048: A rest parameter cannot have an initializer.
1 function testRestInitializer(...args: string[] = ['default']) {
~~~~OR (without --pretty flag):
docs/1048/index.ts(1,33): error TS1048: A rest parameter cannot have an initializer.