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.
error TS2503: Cannot find namespace 'JSX'.Cannot find namespace 'NodeJS'.TS2503 Cannot find namespacets(2503) Cannot find namespace 'Express' 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/reactmissing- React 19 removed the global JSX namespace
typesarray excluding them- Library typing mismatch
- Wrong lib config
⚡ Quick fix
npm i -D @types/node @types/react- React 19: use
React.JSX.Element - Ensure
types/typeRootsinclude them
Detailed fix by platform
TypeScript
type Timer = ReturnType<typeof setTimeout>; // avoids NodeJS.Timeout
How to diagnose
- Namespace — Which?
- Types — Installed?
- 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:
Similar errors
- Cannot find module './App.vue' or its corresponding type declarations TypeScript: error TS2307: Cannot find module './App.vue' or its corresponding type declarations.
- ERR_INVALID_ARG_TYPE TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined
- TS1005: ';' expected / ',' expected (syntax error) TypeScript: error TS1005: ';' expected.
Most viewed in TypeScript
- TS2366: Function lacks ending return statement TypeScript: error TS2366: Function lacks ending return statement and return type does not include 'undefined'.
- TS1259: Module can only be default-imported using the 'esModuleInterop' flag TypeScript: error TS1259: Module '"express"' can only be default-imported using the 'esModuleInterop' flag
- TS2305: Module has no exported member TypeScript: error TS2305: Module '"./utils"' has no exported member 'helper'.
Other ways to find it
Where this error sits
Origin: On your device. Errors that are often confused with or caused by this one (click to open):
🧠 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.
Report a correction or suggest an improvement
Last updated 5 Nov 2026