quick-lint-js

Find bugs in JavaScript programs.

E0227: index signature must be a field, not a method

A TypeScript index signature describes a property. TypeScript only supports the field syntax for index signatures. It is a syntax error to write an index signature using method syntax:

interface EventTable {
  [eventName: string](event: Event): void;
}

To fix this error, write the value type using function type syntax instead:

interface EventTable {
  [eventName: string]: (event: Event) => void;
}

Documentation for other errors