TypeScript TS1109 — Expression Expected
Fix TS1109 syntax errors by locating the unexpected token, checking for a stray operator or bracket, and correcting the incomplete expression.
Symptoms
- error TS1109: Expression expected
- The caret points after a comma or an operator
- A line looks fine but a nearby edit introduced the error
Possible causes
- A trailing comma, operator, or dot with nothing following
- An object literal or call is missing a value or closing brace
- Optional chaining or spread is used without an operand
Diagnosis steps
Locate the exact token from the caret
npx tsc --noEmit --pretty 2>&1 | grep -A 3 TS1109Interpretation
The pretty output underlines the unexpected token with the surrounding line, pinpointing the edit.
Check the previous line for an unclosed construct
grep -n "return\|=>\|(\([^)]*$" src/*.ts | headInterpretation
An unclosed parenthesis or arrow with no body often surfaces as an expression-expected error on the next line.
Root cause
TS1109 is a parser error: the grammar expected an expression where it found a token that cannot start one. It almost always follows an incomplete preceding construct such as a dangling operator or unclosed bracket.
Fix
Complete the expression, remove the stray operator or comma, balance brackets, and re-run the parser to confirm the error moves or clears.
Risk note
Fixing the reported line without checking the previous line can leave the real syntax error in place.
Verify the fix
Run tsc --noEmit and confirm TS1109 is gone and no new parse errors remain; format the file to catch bracket imbalance.
Symptoms
The error “TypeScript TS1109 — Expression Expected” points at a specific failure mode. This guide documents the symptoms you can observe, the commands that isolate the cause, the root cause, the fix, and the checks that prove the fix works.
Observed symptoms include:
- error TS1109: Expression expected
- The caret points after a comma or an operator
- A line looks fine but a nearby edit introduced the error
Reproduce and Diagnose
Reproduce the failure in isolation before changing any code. Work through the checks below in order; each one narrows the search space.
Step 1: Locate the exact token from the caret
npx tsc --noEmit --pretty 2>&1 | grep -A 3 TS1109
The pretty output underlines the unexpected token with the surrounding line, pinpointing the edit.
Step 2: Check the previous line for an unclosed construct
grep -n "return\|=>\|(\([^)]*$" src/*.ts | head
An unclosed parenthesis or arrow with no body often surfaces as an expression-expected error on the next line.
Likely contributors, in order of frequency:
- A trailing comma, operator, or dot with nothing following
- An object literal or call is missing a value or closing brace
- Optional chaining or spread is used without an operand
Root Cause
TS1109 is a parser error: the grammar expected an expression where it found a token that cannot start one. It almost always follows an incomplete preceding construct such as a dangling operator or unclosed bracket.
The Fix
Complete the expression, remove the stray operator or comma, balance brackets, and re-run the parser to confirm the error moves or clears.
Watch out: Fixing the reported line without checking the previous line can leave the real syntax error in place.
// ❌ trailing comma after the last element in a context that disallows it
// const x = [1, , ];
// ❌ arrow with no body
// const f = () => ;
// ✅
const x = [1, 2, 3];
const f = () => 42;
const obj = { a: 1 };
Verify and Prevent
Run tsc –noEmit and confirm TS1109 is gone and no new parse errors remain; format the file to catch bracket imbalance.
Once verified, add a regression test that reproduces the original symptom so the failure cannot silently return.
This class of failure is usually environmental rather than pure logic, so capture the exact command, the environment variables, and the working directory in your bug report. Reproduce it in the smallest possible script, then widen the scope only once the minimal case is understood. A short written checklist for this failure mode saves hours the next time it appears.