TS1398
TypeScriptERRORNotableSyntaxHIGH confidence
Imported via X from file 'X' with packageId 'X' to import 'jsx' and 'jsxs' fa...
Production Risk
Build will fail; resolve before shipping.
What this means
A syntax error (TS1398): Imported via X from file 'X' with packageId 'X' to import 'jsx' and 'jsxs' factory functions. This diagnostic is emitted by the TypeScript compiler when imported via X from file 'X' with packageId 'X' to import 'jsx' and 'jsxs' factory functions.
Why it happens
- 1JSX syntax used without enabling '--jsx' compiler option
- 2Missing React or JSX runtime import
How to reproduce
TypeScript compiler reports TS1398 during type checking.
trigger — this will error
trigger — this will error
// Triggers TS1398 // Imported via X from file 'X' with packageId 'X' to import 'jsx' and 'jsxs' factory functions
expected output
error TS1398: Imported via X from file 'X' with packageId 'X' to import 'jsx' and 'jsxs' factory functions
Fix
Enable JSX in tsconfig.json
WHEN Using JSX syntax in TypeScript files
Enable JSX in tsconfig.json
// tsconfig.json
{
"compilerOptions": {
"jsx": "react-jsx" // or "react", "preserve", etc.
}
}Why this works
The '--jsx' option tells TypeScript how to transform JSX; choose 'react-jsx' for React 17+ or 'react' for older versions.
Sources
Official documentation ↗
TypeScript Compiler Diagnostics
Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev