quick-lint-js

Find bugs in JavaScript programs.

E0308: TypeScript optional parameters are not allowed in JavaScript

In TypeScript, parameters can be explicitly marked as optional. It is a syntax error to write ? to mark a parameter optional in JavaScript:

async function download(uri, options?) {
  options ||= getDefaultOptions();
  /* ... */
}

In JavaScript, all parameters are optional. To fix this syntax error, remove ? from the parameter:

async function download(uri, options) {
  options ||= getDefaultOptions();
  /* ... */
}

Introduced in quick-lint-js version 2.10.0.

Documentation for other errors