Typescript- Null or undefined?

This is what Copilot told me, not sure if it is correct:

The Rushstack guidance (followed by many TS codebases) prefers undefined for “no value” in modern TypeScript/JS, and reserves null only for:

  • Interop with legacy APIs that already return or accept null (e.g., some DOM or 3rd‑party libraries).
  • Data formats like JSON where null is part of the schema.

This avoids the complexity of having to consider both null and undefined everywhere.

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply