quick-lint-js

Find bugs in JavaScript programs.

E0282: use ':' instead of 'as' to type a function parameter

The as operator is not allowed in function parameters. It is a syntax error to use as to annotate a parameter with a type:

function reversed<T>(array as T[]): T[] {
  return [...array].reverse();
}

To fix this error, write : instead of as:

function reversed<T>(array: T[]): T[] {
  return [...array].reverse();
}

Documentation for other errors