quick-lint-js

Find bugs in JavaScript programs.

E0214: use of undeclared type

A TypeScript type annotation must refer to a class, enum, generic parameter, interface, or type alias. It is an error to a type which does not exist:

interface Response {
  ok: bool;
  error?: string;
  data?: object;
}

function padString(
  s: string,
  alignment: Alignment,
): string {
  /* ... */
}

const Title: FC = () => {
  return <h1>Welcome!</h1>;
};

To fix this error, fix the name of the referenced type:

interface Response {
  ok: boolean;
  error?: string;
  data?: object;
}

Alternatively, declare the type:

enum Alignment { LEFT, RIGHT, CENTER };

function padString(
  s: string,
  alignment: Alignment,
): string {
  /* ... */
}

Alternatively, import the type:

import {type FC} from "react";

const Title: FC = () => {
  return <h1>Welcome!</h1>;
};

Alternatively, if the type is global in your environment, write a quick-lint-js.config file.

Introduced in quick-lint-js version 2.5.0.

Documentation for other errors