TypeScript Diagnostic

How to Fix TypeScript Error TS2304: Cannot find name '<identifier>'

TypeScript throws TS2304 when the compiler encounters an identifier that has not been declared in the current lexical scope, imported from an external module, or provided by ambient type definitions.

TS2304: Cannot find name

Quick Fix Checklist

  1. Auto-import the missing symbol using quick fixes (Ctrl+. or Cmd+.) in your editor
  2. Add "@types/node": "^20.0.0" to package.json devDependencies if using process or Buffer
  3. Add "DOM" and "ES2022" to the "lib" array in tsconfig.json if using browser APIs
  4. Augment the Window interface using "declare global { interface Window { ... } }"