• Error
  • Reported by the lexer and parser

TS1134

Variable declaration expected.

After `var`, `let` or `const`, the parser expected a variable name or destructuring pattern but found something else.

What it means

A variable statement needs at least one declaration: a name or a {...} / [...] pattern. This is reported when the keyword is followed by ;, a number, or another token that can't be a name.

Example

index.ts
var ;
export {};
ts-r-check -p tsconfig.json --pretty false ts-r output
index.ts(1,5): error TS1134: Variable declaration 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

  • Add the variable name: var count;.
  • Names can't start with a digit: const x1 = 1, not const 1x = 1.