TypeScript Errors
Assignability, missing declarations, strict null checks and generic constraints.
Understanding TypeScript errors
TypeScript errors are the compiler describing a mismatch between what you declared and what you did. Nearly all of them fall into assignability (this shape is not that shape), missing declarations (a JavaScript package with no types), or strict null checks (a value can be undefined on a path you did not handle). Casting with as or any silences the message without fixing the underlying mismatch, which usually reappears at runtime.
How to debug TypeScript errors
- Read the error from the innermost "Types of property X are incompatible" line outward. That nested line names the actual mismatch.
- For missing declarations, try
npm i -D @types/<pkg>first; if none exists, write a minimal.d.tsrather than reaching forany. - Narrow rather than assert. A type guard, an
incheck, or an early return preserves safety whereasdiscards it. - Use
tsc --noEmit --prettyto check the whole project; editors sometimes use a different TypeScript version than the build. - Check
strict,skipLibCheckandmoduleResolutionin tsconfig when errors appear only in CI or only in the editor.
Tools worth reaching for
tsc --noEmitts-node / tsx@types/* packagestypescript-eslinteditor TS version selector
All 19 TypeScript errors
- TypeScript: 'error' is of type 'unknown' (TS18046) NewSince TypeScript 4.4, useUnknownInCatchVariables (part of strict) types the catch binding as unknown rather than any…
- TypeScript: Argument of type X is not assignable to parameter of type YA function argument's type doesn't match the parameter's declared type. Common when passing objects with extra or…
- TypeScript: Cannot find module './x.js' or its corresponding type declarations NewWith module set to node16 or nodenext, TypeScript resolves imports exactly as Node does at runtime, so a relative ESM…
- TypeScript: Cannot find name 'process' NewThe Node global types are not loaded. Either @types/node is missing, or the compilerOptions.types array is set, which…
- TypeScript: Cannot redeclare block-scoped variable 'name' NewA file with no import or export is treated as a script, not a module, so its top level declarations land in the global…
- TypeScript: Cannot use JSX unless the '--jsx' flag is provided NewA .tsx file was compiled with JSX support off. Either the option is missing, or the editor is using a different…
- TypeScript: Could not find a declaration file for moduleA JS library has no TypeScript type declarations. The library has no built-in types and no @types package exists.
- TypeScript: Module can only be default-imported using the 'esModuleInterop' flag NewThe package is CommonJS and sets module.exports directly, so it has no ES default export to bind. esModuleInterop…
- TypeScript: No overload matches this callNone of the function's overload signatures match the provided arguments. The argument types or count don't match any…
- TypeScript: Object is possibly 'undefined'Accessing a property on a value that might be undefined. TypeScript's strict null checks flag this as unsafe.
- TypeScript: Option 'module' must be set to 'NodeNext' NewmoduleResolution and module are not independent: the Node16 and NodeNext resolution modes read package.json exports…
- TypeScript: Parameter 'x' implicitly has an 'any' type (TS7006) NewUnder noImplicitAny, which strict turns on, TypeScript refuses a parameter it cannot infer. Callback parameters are…
- TypeScript: Property 'X' does not exist on type 'Y'Accessing a property that is not defined in the type. The object may need a wider type or the property name has a typo.
- TypeScript: The inferred type of X cannot be named without a reference to Y NewWhen emitting declaration files, TypeScript needs to write out the type of an exported value, but that type lives in a…
- TypeScript: Two different types with this name exist, but they are unrelated NewTwo copies of the same type package are installed at different paths, usually @types/react or @types/node pulled in at…
- TypeScript: Type 'X' is not assignable to type 'Y'A value's type is incompatible with the expected type. This is TypeScript's most common error, catching type…
- TypeScript: Type instantiation is excessively deep (TS2589) NewThe compiler hit its recursion limit while expanding a conditional or mapped type. It comes from deeply recursive…
- TypeScript: Type X does not satisfy the constraint YA type argument does not meet the generic constraint. The type must extend or implement the constraint type.
- TypeScript: type-only import must use 'import type' (verbatimModuleSyntax) NewWith verbatimModuleSyntax enabled, TypeScript emits import statements exactly as written. An import used only as a…
Other categories
- AI 35Rate limits, context windows, GPU memory and model-serving failures.
- Ansible 10Unreachable hosts, become passwords, undefined variables and Jinja2 failures.
- API 14Auth headers, payload limits, versioning, idempotency and webhook signatures.
- Apple 10Command line tools, dyld, Homebrew permissions, notarisation and Keychain.
- Auth 11OIDC, SAML, Auth0, Okta, Keycloak, passkeys and MFA failures.
- BigData 11Spark, Kafka, Airflow, Snowflake, Flink and Databricks failures.
- C# 12NuGet restore, null references, EF Core migrations, async deadlocks and Blazor…
- C++ 11Segfaults, linker errors, memory corruption and template deduction failures.
- Caching 10Cache stampedes, stale content, Varnish and CloudFront failures.
- CI/CD 18GitHub Actions, GitLab CI, Jenkins, CircleCI: permissions, runners and…
- Client 21CORS, mixed content, module resolution, memory limits and framework runtime…
- Cloud 25IAM permissions, quotas, service limits and credential failures.
- Dart 10Null safety, pub version solving and build toolchain problems.
- Database 41Connections, deadlocks, constraints, replication and memory limits.
- DNS 10NXDOMAIN, SERVFAIL, timeouts, propagation and delegation problems.
- Docker 27Daemon connectivity, disk space, image pulls, ports and architecture mismatches.
- Elixir 9GenServer timeouts, supervision failures and Mix compilation problems.
- Email 8Delivery failures, relay denial, authentication, SPF, DKIM and DMARC.
- Frontend 23Hydration mismatches, bundler resolution, layout shift and font loading.
- Git 20Merge conflicts, rejected pushes, detached HEAD, LFS and repository corruption.
- Go 19Nil map assignment, concurrent map access, context cancellation and deadlocks.
- GraphQL 13Validation, depth limits, N+1 queries and fragment problems.
- gRPC 10Status codes, deadlines, message limits, TLS and HTTP/2 transport failures.
- HTTP 494xx client errors, 5xx server errors, redirects, headers and protocol problems.
- ICMP 23Destination unreachable, time exceeded, fragmentation needed and redirects.
- Ingress 8404 default backend, missing TLS secrets, IngressClass and path matching.
- Java 19Class loading, dependency resolution, connection pools and JVM version…
- JavaScript 42npm resolution, async pitfalls, hydration, memory limits and runtime type…
- Kubernetes 34CrashLoopBackOff, ImagePullBackOff, OOMKilled, RBAC, scheduling and storage.
- Logging 9Log4j, Logback, Fluentd, Logstash and CloudWatch ingestion problems.
- MessageQueue 14Kafka, RabbitMQ, SQS, NATS and Celery: lag, rebalancing and poison messages.
- Mobile 17Gradle, CocoaPods, Xcode signing, Metro bundler and toolchain mismatches.
- Monitoring 12Prometheus scrapes, Grafana data sources, OpenTelemetry exporters and agent…
- Network 35Refused connections, timeouts, resets, MTU problems and port exhaustion.
- Performance 6GC pauses, thread pool starvation and event loop blocking.
- PHP 11Memory limits, execution timeouts, autoloading, Composer and PDO connections.
- Proxy 17nginx, Envoy, HAProxy, Traefik, Caddy and Cloudflare upstream failures.
- Python 35Imports, virtual environments, encoding, concurrency and dependency conflicts.
- Regex 8Catastrophic backtracking, back references, escaping and engine differences.
- Ruby 11Bundler, migrations, native extensions, encoding and asset compilation.
- Rust 19Borrow checker, ownership moves, trait bounds and lifetime mismatches.
- Scala 6Dependency resolution, binary compatibility and type inference failures.
- Security 25JWT validation, CSRF, OAuth grants, SELinux, SSH host keys and CSP.
- Serverless 11Lambda timeouts, package size limits, VPC networking and cold starts.
- Shell 13Command not found, permissions, quoting, expansion and Makefile syntax.
- Storage 13S3 permissions, NFS mounts, quotas, signed URLs and volume attachment.
- Svelte 10Store subscriptions, load functions and server/client boundaries.
- System 26Disk space, systemd units, file descriptors, OOM killer and scheduled jobs.
- Terraform 18State locks, provider auth, drift, dependency cycles and plan-time unknowns.
- Testing 18Jest, pytest, JUnit, Cypress and Playwright: fixtures, snapshots and timeouts.
- TLS 24Untrusted authorities, expiry, hostname mismatch, chains and cipher negotiation.
- Virtualization 8VirtualBox, VMware, Hyper-V, WSL, KVM and hypervisor conflicts.
- Web3 7Gas estimation, nonce management and reverted transactions.
- WebAssembly 7Compile errors, memory bounds and host binding mismatches.
- WebServer 10nginx, Apache, IIS and Caddy: binding, permissions, rewrites and TLS.
- Windows 10Installer failures, missing runtimes, update errors and permission problems.