TypeScript Syntax Checker

Paste TypeScript to find syntax errors before running tsc. It parses interfaces, generics, decorators, enums and TSX, and tells you where the code stops making sense to the compiler.

Input

Settings

History

Load from URL

Syntax errors versus type errors

TypeScript reports two very different kinds of problem, and it helps to know which one you are chasing.

Syntax errors mean the file cannot be parsed at all: an interface without its closing brace, type Status = 'paid' | | 'shipped', a parameter list missing a comma. Nothing else works until these are fixed, because the compiler cannot build a syntax tree. This page finds them.

Type errors mean the code parses but the types disagree: assigning 'text' to a number, calling a method that does not exist, forgetting a required property. Finding those requires the whole program, your tsconfig.json and every imported declaration file, so they are out of reach for a paste-in tool. Run tsc --noEmit or rely on your editor for them.

The distinction matters when you paste a snippet from a pull request or a chat: if it fails here, it is broken regardless of context; if it passes, any remaining errors are about types.

How errors are reported

The checker uses the TypeScript parser through Prettier, so the messages are the compiler’s own: '}' expected., ',' expected., Type expected., Property or signature expected. Each comes with a line and column that the editor highlights. TypeScript often reports a problem one line after its cause; an unclosed interface, for example, is reported at the first line that cannot belong to it. Until you fix it, the output pane shows the last successfully formatted version, faded, for comparison.

A practical tip for long files: fix only the first reported error, then check again. A single missing brace near the top can make every later declaration look broken, and those follow-on messages disappear once the real cause is gone.

Everything runs in your browser tab, so proprietary source is never uploaded.

Supported syntax and known gaps

Declaration-file syntax works too, so you can check a hand-written .d.ts with declare module 'shop-sdk' { ... } blocks and overloaded function signatures. Interfaces, type aliases, generics with constraints and defaults, mapped and conditional types, enums, namespaces, abstract classes, parameter properties (constructor(private repo: Repo)), decorators, satisfies, import type and TSX all parse. The parser tries your code both with and without JSX, so a paste does not need a file extension to be understood. Keep in mind that inside a real .tsx file, an arrow function with a generic parameter needs a trailing comma (<T,>(value: T) => value) so the compiler does not read it as a JSX tag.

Beyond type checking, a few compiler checks also depend on project settings: erasableSyntaxOnly, isolatedModules restrictions and which lib types exist. Those are not evaluated here. If you only need to know whether plain JavaScript parses, the JavaScript validator uses Babel and gives Babel-style messages instead.

Examples

Interface missing its closing brace

Invalid: Order is never closed, so the parser reports the export on line 6 as an unexpected member of the interface.

Input
interface Order {
  id: string;
  total: number;
  status: 'paid' | 'shipped';

export function describe(order: Order): string {
  return `${order.id}: ${order.status}`;
}
Result
Line 6, column 1: Property or signature expected.
Open this example in the tool

Empty member in a union type

Invalid: there is nothing between the two | operators, which TypeScript reports as Type expected.

Input
type Status = 'pending' | | 'paid' | 'shipped';
Result
Line 1, column 27: Type expected.
Open this example in the tool

Parameter list missing a parenthesis

Invalid: the ) after the parameters is missing, so the compiler expects ‘,’ before the opening brace.

Input
function formatPrice(amount: number, currency: string {
  return new Intl.NumberFormat('en-SG', { style: 'currency', currency }).format(amount);
}
Result
Line 1, column 55: ',' expected.
Open this example in the tool

Parses fine, but has a type error

Passes the syntax check even though tsc would reject the string assigned to a number, because that is a type error.

Input
const retries: number = 'three';

function total(items: { qty: number; price: number }[]): number {
  return items.reduce((sum, i) => sum + i.qty * i.price, 0);
}
Output
const retries: number = "three";

function total(items: { qty: number; price: number }[]): number {
  return items.reduce((sum, i) => sum + i.qty * i.price, 0);
}
Open this example in the tool

Common errors and how to fix them

ErrorCauseFix
'}' expected.A block, interface, class or object type is missing its closing brace.Add the brace where the declaration should end; the reported line is often the first line after it.
',' expected.A parameter list, generic argument list or object type is missing a separator or a closing parenthesis.Look just before the reported column for the missing comma or ).
Type expected.A type annotation or union is incomplete, as in let x: = 5 or A | | B.Write the missing type or remove the extra operator.
Property or signature expected.Code that is not a member appears inside an interface or type literal, usually because the previous declaration was not closed.Close the interface or type before the line that is reported.

Frequently asked questions

Does this check types like tsc does?

No. It checks syntax only. Type checking needs your whole project and tsconfig, so use tsc --noEmit or your editor for type errors.

Can it check TSX files with React components?

Yes. JSX inside TypeScript is parsed. Remember that generic arrow functions in TSX need a trailing comma in the type parameter list.

Are decorators supported?

Yes. Decorators on classes, methods, properties and parameters parse, which covers Angular and NestJS code.

Why does the error point to the line after my mistake?

The parser only notices a problem when it reads a token that cannot continue the current construct. A missing brace is detected at the next declaration, not where the brace should have been.

Related tools