menu

no-useless-spread

Disallow spreads that have no observable effect

Spreading an inline literal directly into another literal or wrapping an iterable for an API that already accepts it creates an unnecessary intermediate value. Instead, you SHOULD place the literal entries directly in the list or pass the iterable directly.

Reported

1function append(output: int32[]): void {2    output.push(1, ...[2, 3], 4);3}

Accepted

1function append(output: int32[]): void {2    output.push(1, 2, 3, 4);3}