- Error
- Reported by the lexer and parser
TS1382
Unexpected token. Did you mean `{'>'}` or `>`?
A `>` appears in JSX text. Write `{'>'}` or `>` to show the character, or check for a malformed tag.
What it means
A bare > in JSX text is not allowed; it often means a tag was closed twice or an attribute was written wrongly. To show the character itself, it has to be escaped.
Example
export const a = <div>></div>;
{
"compilerOptions": {
"strict": true,
"target": "es2022",
"module": "esnext",
"moduleResolution": "bundler",
"noEmit": true,
"jsx": "preserve"
}
}
ts-r-check -p tsconfig.json --pretty false ts-r outputindex.tsx(1,23): error TS1382: Unexpected token. Did you mean `{'>'}` or `>`?
Recorded by node scripts/verify-examples.mjs with ts-r built from commit 6deaf01.
How to fix
- Fix the tag if the
>is a typo. - To display it, write
{'>'}or>.