the tswhy logo: a question mark in a box

tswhy‽

A community effort to enrich TypeScript diagnostics.

Editing TS1013:

All diagnostics and fixes are authored in markdown. Propose any changes by editing the markdown. Additional fixes can be added. A preview of the rendered diagnostic will update when changes are made.

Once all proposed changes are made, the Propose button will submit the information and confirm raising the PR.

TS1013

A rest parameter or binding pattern may not have a trailing comma.

If a function uses destructuring to consume the last argument in a function or has a rest argument, the argument may not have a trailing comma.

function test(...args: any[]) {}

Fix: Remove trailing comma

To fix the error, remove the trailing comma:

function test(...args: any[]) {}