• Error
  • Reported by the lexer and parser

TS1131

Property or signature expected.

Inside an interface or type literal, the parser expected a property or signature but found another token.

What it means

Interface bodies and object type literals contain property signatures (x: number), method signatures, call and construct signatures, and index signatures. Anything else is reported here, such as an = initialiser (types can't have values) or stray punctuation.

Example

index.ts
export type P = {
  x: number;
  =
};
ts-r-check -p tsconfig.json --pretty false ts-r output
index.ts(3,3): error TS1131: Property or signature expected.

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 the stray token.
  • Types can't hold values: move default values to the code that creates objects of this type.