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

**Code:** `TS2503: Cannot find namespace 'X'` · **Category:** TypeScript · **Seen on:** TypeScript, React

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

## 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?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/typescript/ts2503-cannot-find-namespace)
