This post explains the differences very well. They are the same in TypeScript as in JavaScript.

As for what you should use: You may define that on your own. You may use either, just be aware of the differences and it might make sense to be consistent.

The TypeScript coding style guide for the TypeScript source code (not an official "how to use TypeScript" guide) states that you should always use undefined and not null: Typescript Project Styleguide.

Answer from Spitzbueb on Stack Overflow
🌐
TypeScript
typescriptlang.org › docs › handbook › release-notes › typescript-2-0.html
TypeScript: Documentation - TypeScript 2.0
TypeScript has two special types, Null and Undefined, that have the values null and undefined respectively.
🌐
W3Schools
w3schools.com › typescript › typescript_null.php
TypeScript Null & Undefined
let value: string | undefined | null = null; value = 'hello'; value = undefined; Try it Yourself » · When strictNullChecks is enabled, TypeScript requires values to be set unless undefined is explicitly added to the type.
🌐
Reddit
reddit.com › r/typescript › undefined vs null
r/typescript on Reddit: Undefined vs null
February 27, 2023 -

Since switching to TypeScript I have been using a lot of optional properties, for example:

type store = {
  currentUserId?: string
}

function logout () {
  store.currentUserId = undefined
}

However my coworkers and I have been discussing whether null is a more appropriate type instead of undefined, like this:

type store = {
  currentUserId: string | null
}

function logout () {
  store.currentUserId = null
}

It seems like the use of undefined in TypeScript differs slightly from in Javascript.

Do you guys/girls use undefined or null more often? And, which of the examples above do you think is better?

🌐
DEV Community
dev.to › sduduzog › null-vs-undefined-what-to-choose-what-to-use-11g
null vs undefined? What to choose? What to use? - DEV Community
August 23, 2023 - JSON.stringify({ foo: null bar: undefined }) Typescript particularly makes these choices very loud, as when you're defining your types, you need to specify whether a property of an object or a variable can hold either null, undefined or some type. Let's make a scenario to conclude this mini rant.
🌐
Marius Schulz
mariusschulz.com › blog › nullish-coalescing-the-operator-in-typescript
Nullish Coalescing: The ?? Operator in TypeScript — Marius Schulz
August 14, 2021 - TypeScript 3.7 added support for the ?? operator, which is known as the nullish coalescing operator. We can use this operator to provide a fallback value for a value that might be null or undefined.
Find elsewhere
🌐
Medium
medium.com › @AlexanderObregon › where-null-and-undefined-are-watched-in-typescript-647ecabe346f
Where Null and Undefined Are Watched in TypeScript | Medium
July 1, 2025 - TypeScript keeps track of values that might be missing by tying them directly to how your types are declared and how your logic flows. It doesn’t treat null and undefined like special one-off cases. Instead, it treats them like any other possible value a variable might hold, and it expects you to make that possibility part of the type.
🌐
Omarileon
omarileon.me › blog › typescript-null-undefined
mari. | How to Detect Null and Undefined in Your TypeScript Code
February 27, 2024 - It's just nullish-coalescing and assignment combined - if the value on the right is non-null, it will be assigned to the value on the left. TypeScript also provides a useful shortcut for checking if a property on an object might be null or undefined.
🌐
Chrlschn
typescript-is-like-csharp.chrlschn.dev › pages › basics › nulls.html
Null Handling | TypeScript is Like C#
In JavaScript and TypeScript, null and undefined are distinct values. null is an intentional absence of a value, while undefined represents a variable that has been declared but not assigned a value.
🌐
C# Corner
c-sharpcorner.com › article › explain-null-handling-in-typescript
Explain Null Handling in TypeScript
March 21, 2024 - Null handling in TypeScript involves managing null and undefined values effectively to prevent runtime errors. Techniques like nullable types, optional chaining, type guards, and non-null assertion operators help ensure code reliability.
🌐
Mikevosseller
blog.mikevosseller.com › 2022 › 10 › 03 › when-to-use-null-vs-undefined-with-optional-parameters-in-typescript.html
When to use null vs undefined with optional parameters in TypeScript | mpv’s little blog
October 4, 2022 - The problem is that an optional string allows a string or undefined but we are passing null which is different. undefined is more like omitted / “no value present” while null is more like a special value that indicates “no object”. Confusing I know.
🌐
typescriptlang.org
typescriptlang.org › docs › handbook › 2 › everyday-types.html
TypeScript: Documentation - Everyday Types
Reminder: Because type assertions are removed at compile-time, there is no runtime checking associated with a type assertion. There won’t be an exception or null generated if the type assertion is wrong. TypeScript only allows type assertions which convert to a more specific or less specific ...
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Operators › null
null - JavaScript | MDN
Like undefined, accessing any property on null throws a TypeError instead of returning undefined or searching prototype chains.
🌐
GeeksforGeeks
geeksforgeeks.org › typescript › explain-the-concept-of-null-and-its-uses-in-typescript
Explain the concept of null and its uses in TypeScript - GeeksforGeeks
July 23, 2025 - Typescript uses null to represent variables that have an absence of values or no value assigned to them in short.
🌐
Medium
medium.com › @tar.viturawong › a-note-on-typescript-non-null-assertion-operator-bad8fbe62bba
A note on TypeScript non-null assertion operator | by Tar Viturawong | Medium
March 25, 2019 - The fine print of this operator is that it is completely your responsibility to take the risk of ignoring the nullness of your expression. In fact, TypeScript’s release note implicitly hints at a good practice:
🌐
GitHub
github.com › microsoft › TypeScript › issues › 9653
Guidelines for choosing between `null` and `undefined` with `strictNullChecks` · Issue #9653 · microsoft/TypeScript
July 12, 2016 - Whenever you want to make a type optional you have to choose what value to use for the missing values: undefined: Has the benefit that is already there when you don't write anything. lib.d.ts contains 12 references of | undefined. null: ...
Author   microsoft
🌐
DEV Community
dev.to › thinkster › 2-methods-for-dealing-with-nulls-in-typescript-4kn0
2 Methods for Dealing with Nulls in TypeScript - DEV Community
September 10, 2020 - The above code would throw an error with the strict null check. You're creating a user, and initializing it to null, but not declaring it as a nullable type. In order to do that, and make it possibly be nullable, use the union operator like so: This won't throw a TypeScript error.
🌐
GitBook
basarat.gitbook.io › typescript › recap › null-undefined
Null vs. Undefined | TypeScript Deep Dive
August 18, 2020 - Setting attribute values to undefined can save on storage and transmission costs, as the attribute names will not be encoded. However, this can complicate the semantics of clearing values vs. absent values. TypeScript team doesn't use null : ...