TS2503: Cannot find namespace 'X' TypeScript Origin: On your device OSI layer 7 · Application Last updated 5 Nov 2026

TypeScript: error TS2503: Cannot find namespace 'JSX'. / Cannot find namespace 'NodeJS'

Code references a global namespace (JSX, NodeJS, Express) that isn't declared — missing @types or lib settings.

Exact message you may see error TS2503: Cannot find namespace 'JSX'.Cannot find namespace 'NodeJS'.TS2503 Cannot find namespacets(2503) Cannot find namespace 'Express'
Seen on: TypeScript React

Meaning

Install the typings (@types/node for NodeJS, @types/react for JSX (React.JSX in React 19), @types/express), include them via types/auto-include, and for React 19 replace global JSX.Element with React.JSX.Element or ReactElement.

Common causes

  • @types/node / @types/react missing
  • React 19 removed the global JSX namespace
  • types array excluding them
  • Library typing mismatch
  • Wrong lib config

⚡ Quick fix

  1. npm i -D @types/node @types/react
  2. React 19: use React.JSX.Element
  3. Ensure types/typeRoots include them

Detailed fix by platform

TypeScript

  1. type Timer = ReturnType<typeof setTimeout>; // avoids NodeJS.Timeout

How to diagnose

  1. Namespace — Which?
  2. Types — Installed?
  3. React — 19?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: On your device. Errors that are often confused with or caused by this one (click to open):

Cannot find module './App.vue' or its corresponding type declarations — TypeScript: error TS2307: Cannot find module './App.vue' or its corresponding type declarations. (Vue)Cannot find module '.…ERR_INVALID_ARG_TYPE — TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined (Node.js)ERR_INVALID_ARG_TYPETS1005: ';' expected / ',' expected (syntax error) — TypeScript: error TS1005: ';' expected. (TypeScript)TS1005: ';' expected …TS2304 — TS2304: Cannot find name 'x'. (Node.js)TS2304TS2322 — TS2322: Type 'X' is not assignable to type 'Y' (TypeScript)TS2322TS2339 — TS2339: Property 'x' does not exist on type 'Y'. (Node.js)TS2339TS2345 — TS2345: Argument of type 'string | undefined' is not assignable to parameter of type 'string'. (Node.js)TS2345TS2564 — TS2564: Property 'x' has no initializer and is not definitely assigned in the constructor (TypeScript)TS2564TS2503: C…

Explore the map of this error Full error map →

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.