• Error
  • Reported by the type checker

TS1029

'{0}' modifier must precede '{1}' modifier.

Two modifiers are written in the wrong order. Swap them so the first one named in the message comes first.

What it means

Modifiers on class members have a fixed order: accessibility (public, private, protected) comes before static, override, readonly and accessor, for example. The message names both modifiers and which one must come first.

Example

index.ts
export class User {
  static public count = 0;
}
ts-r-check -p tsconfig.json --pretty false ts-r output
index.ts(2,10): error TS1029: 'public' modifier must precede 'static' modifier.

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

  • Reorder the modifiers as the message says: public static count = 0.