Skip to content
Latchkey

TS17004: Cannot use JSX unless the jsx flag is provided - in CI

A file contains JSX but the tsconfig does not enable JSX compilation.

What this error means

Type-checking fails with TS17004 at the first JSX element because the jsx option is unset.

tsc
src/App.tsx(4,10): error TS17004: Cannot use JSX unless the '--jsx' flag is provided.

Common causes

How to fix it

Set the jsx option

  1. Use react-jsx for the modern automatic runtime, or react for classic
tsconfig.json
{
  "compilerOptions": { "jsx": "react-jsx" }
}

Use the .tsx extension

  1. Rename files containing JSX to .tsx
shell
mv src/App.ts src/App.tsx

How to prevent it

  • Set jsx in tsconfig and keep JSX in .tsx files so CI compiles components.

Frequently asked questions

What causes "TS17004 JSX not enabled"?
Type-checking fails with TS17004 at the first JSX element because the jsx option is unset.
How do I fix TS17004 JSX not enabled?
Set the jsx option

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card