• Error
  • Reported by the lexer and parser

TS17002

Expected corresponding JSX closing tag for '{0}'.

A JSX closing tag doesn't match the opening tag it closes. Make the names match.

What it means

In JSX every element must be closed by a tag with the same name. When the closing tag names a different element, ts-r's parser reports this at the closing tag, naming the element it expected.

Example

index.tsx
export const el = <div>text</span>;
ts-r-check -p tsconfig.json --pretty false ts-r output
index.tsx(1,30): error TS17002: Expected corresponding JSX closing tag for 'div'.

Recorded by node scripts/verify-examples.mjs with ts-r built from commit 6deaf01. The example uses the default tsconfig: strict, target: es2022, module: esnext, moduleResolution: bundler.

How to fix

  • Change the closing tag to match the opening one, or fix the nesting so each element closes in order.