Skip to content
Latchkey

tsc TS1005: ';' expected (syntax error) in CI

TS1005 is a parser error: tsc reached a point where it expected a token (often ;) and found something else. It commonly means a genuine typo, or that tsc is parsing JSX/TSX as plain TS.

What this error means

tsc fails with "error TS1005: ';' expected." at a specific line and column, sometimes cascading into further syntax errors below it.

tsc
src/App.tsx:6:17 - error TS1005: ';' expected.

6   return <Button>Click</Button>;
                  ~

Common causes

A genuine syntax typo

A missing comma, an unclosed bracket, or a stray token leaves tsc expecting a ; where the next token does not fit.

JSX in a file tsc is not parsing as JSX

A .tsx file compiled without "jsx" set, or JSX placed in a .ts file, makes tsc treat <Tag> as a comparison and report a syntax error.

How to fix it

Fix the syntax at the reported position

  1. Open the exact line and column from the error.
  2. Correct the missing token or malformed statement.
  3. Re-run tsc, since one syntax error can mask later ones.
Terminal
// ensure JSX files end in .tsx and jsx is configured

Enable JSX parsing for TSX files

If the error is on JSX, set the jsx option and use the .tsx extension so tsc parses the markup.

tsconfig.json
{
  "compilerOptions": { "jsx": "react-jsx" }
}

How to prevent it

  • Put JSX only in .tsx files and set the jsx option.
  • Let the editor flag syntax errors before pushing.
  • Run tsc locally so parser errors are caught before CI.

Related guides

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