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
- Inspect the reported line and the lines just above for an unmatched brace
Enable required syntax
- 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
TS1005: ';' expected (or other token) - in CIFix "error TS1005: ';' expected" (and other "X expected" variants) when tsc runs in CI - a syntax error or a…
TS1109: Expression expected - in CIFix "error TS1005/TS1109: Expression expected" when tsc runs in CI - a parser error from malformed syntax or…
TS17004: Cannot use JSX unless the jsx flag is provided - in CIFix "error TS17004: Cannot use JSX unless the '--jsx' flag is provided" when tsc runs in CI - set compilerOpt…