• Error
  • Reported by the type checker

TS2388

Function overload must not be static.

Overloads of a class method mix static and instance signatures. Remove static from the overload, or make the whole member static.

What it means

This is the counterpart of TS2387: the first signature for the name is an instance method, and a later signature or the implementation is marked static.

Example

index.ts
export class Ids {
  next(prefix: string): string;
  static next(prefix: string): string {
    return prefix + "1";
  }
}
ts-r-check -p tsconfig.json --pretty false ts-r output
index.ts(3,10): error TS2388: Function overload must not be static.

Recorded by node scripts/verify-examples.mjs with ts-r built from commit 6deaf01. The example uses the default tsconfig: strict, target: es2022, module: esnext, moduleResolution: bundler.

How to fix

  • Remove static so every signature and the implementation are instance methods.
  • Or make all of them static, if the method doesn't use this.