• Error
  • Reported by the type checker

TS7026

JSX element implicitly has type 'any' because no interface 'JSX.{0}' exists.

JSX is used but no `JSX.IntrinsicElements` type is declared, usually because React's types aren't installed or `jsx` isn't set.

What it means

To type-check JSX, the checker looks for a global JSX namespace (or the one from the jsxImportSource package) with interfaces such as IntrinsicElements. When it doesn't exist, every JSX element would be any and this is reported for each element. It usually means the React types (or your framework's JSX types) aren't installed or aren't reachable from the project.

Example

index.tsx
export const el = <div>hello</div>;
ts-r-check -p tsconfig.json --pretty false ts-r output
index.tsx(1,19): error TS7026: JSX element implicitly has type 'any' because no interface 'JSX.IntrinsicElements' exists.
index.tsx(1,19): error TS17004: Cannot use JSX unless the '--jsx' flag is provided.
index.tsx(1,29): error TS7026: JSX element implicitly has type 'any' because no interface 'JSX.IntrinsicElements' exists.

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

  • Install the types for your JSX runtime, for example npm i -D @types/react.
  • Check that jsx and jsxImportSource in tsconfig.json point at that runtime.