Skip to content
Latchkey

TS1128: Declaration or statement expected - in CI

tsc found a token where a declaration or statement should begin - usually an extra brace, comma, or misplaced syntax.

What this error means

Type-checking fails with TS1128, often pointing just after an extra closing brace or a stray character.

tsc
src/index.ts(40,1): error TS1128: Declaration or statement expected.

Common causes

How to fix it

Balance braces and remove stray tokens

  1. Inspect the reported line and the lines just above for an unmatched brace

Enable required syntax

  1. Set jsx in tsconfig for JSX, or experimentalDecorators for decorators if used
tsconfig.json
{
  "compilerOptions": { "jsx": "react-jsx" }
}

How to prevent it

  • Use a formatter/linter to catch brace imbalance and keep tsconfig syntax flags matched to your code.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →