TS1005
TypeScript Programming Language
Severity: MinorWhat Does This Error Mean?
TypeScript error TS1005 means the compiler found a syntax error — something is missing or in the wrong place in your code. The error says what it expected to find, such as a semicolon, a closing bracket, or a comma. This is usually caused by a typo, a missing character, or a forgotten closing bracket or brace. Fix it by finding the location the compiler points to and adding or correcting the missing character.
Affected Models
- TypeScript 1.0 and later
- All TypeScript versions
- tsc compiler, ts-node, webpack, Vite, Next.js
Common Causes
- Missing closing bracket, brace, or parenthesis: unclosed (, {, or [
- Missing comma between object properties or function parameters
- Using JavaScript-only syntax that is not valid TypeScript
- Incorrect placement of a type annotation — for example, putting a type in the wrong position
- Copy-pasting code from another language that uses different syntax conventions
How to Fix It
-
Look at the line number in the error. The message will say something like "';' expected" or "',' expected" or "'}' expected".
The character in quotes is what TypeScript expected to find but did not. That tells you what is missing.
-
Check for unclosed brackets, braces, or parentheses above the error line. An opening { or ( without a matching } or ) causes everything after it to look wrong.
Use your IDE's bracket-matching feature. In VS Code, click on a bracket and the matching one is highlighted.
-
If the error says a comma is expected, check your object literal or function call for a missing comma between items.
TypeScript follows JavaScript syntax for objects: { key: value, key2: value2 } — a comma after each entry except the last.
-
If you are writing a TypeScript-specific construct like a generic, interface, or type alias, check that the syntax is correct.
Example: const fn = <T>(arg: T): T => arg; — generics in arrow functions use <T> before the parameters.
-
If the error suddenly appears after a recent edit, use your editor's undo (Ctrl+Z) to revert and find what changed.
Syntax errors often cascade — one missing character makes everything after it look invalid. Finding the original mistake fixes many errors at once.
When to Call a Professional
TS1005 is a syntax error that prevents compilation entirely. No code will run until it is fixed. The compiler points to the location of the error, but the real cause is sometimes a few lines earlier. Check above the reported line for a missing closing character.
Frequently Asked Questions
Why does the error line not show the actual problem?
Syntax errors cascade. When a bracket is not closed, the parser gets confused and reports the error much later than where the real problem is. Always look above the reported line for an unclosed bracket, brace, or quote. For example, a missing { on line 10 might only be reported as an error on line 50 where the parser finally gives up.
I see multiple TS1005 errors — should I fix all of them?
Fix the first one at the earliest line number first. A single missing bracket can cause dozens of cascading errors. After fixing the first error, recompile. Many of the other errors will likely disappear. Work through them from top to bottom.
Is TS1005 a TypeScript-only error or does it happen in JavaScript too?
JavaScript has the same kind of syntax errors, but they are only caught at runtime — when the browser runs the code. TypeScript catches them at compile time before the code ever runs. This is one of the practical advantages of TypeScript: syntax mistakes are caught immediately during development.