quick-lint-js

Find bugs in JavaScript programs.

E0224: TypeScript type annotations are not allowed in JavaScript code

JavaScript variables and function returns cannot be explicitly typed with an annotation:

async function fetchJSON(uri: string): Promise<any> {
  let req: Response = await fetch(uri);
  return await req.json();
}

To fix this error, rename your file to have a .ts or .tsx suffix.

Alternatively, use JSDoc to write the annotations:

/**
 * @param {string} uri
 * @returns {Promise<any>}
 */
async function fetchJSON(uri) {
  /** @type {Response} */
  let req = await fetch(uri);
  return await req.json();
}

Introduced in quick-lint-js version 2.6.0.

Documentation for other errors