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

🌐
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. Optional chaining is a JavaScript feature that works well with TypeScript's null handling.
🌐
GitBook
basarat.gitbook.io › typescript › recap › null-undefined
Null vs. Undefined | TypeScript Deep Dive
Something hasn't been initialized : undefined. Something is currently unavailable: null. Fact is you will need to deal with both. Interestingly in JavaScript with ==, null and undefined are only equal to each other:
🌐
TypeScript
typescriptlang.org › docs › handbook › release-notes › typescript-2-0.html
TypeScript: Documentation - TypeScript 2.0
Non-null and non-undefined type guards may use the ==, !=, ===, or !== operator to compare to null or undefined, as in x != null or x === undefined. The effects on subject variable types accurately reflect JavaScript semantics (e.g.
🌐
TutorialsPoint
tutorialspoint.com › typescript › typescript_null_vs_undefined.htm
TypeScript - null vs. undefined
On compiling, it will generate ... value of the variable a is: " + a); // 10 ... When you declare the variable but don't assign any value, TypeScript automatically assigns the 'undefined' value to the variable....
🌐
DEV Community
dev.to › typescripttv › what-is-the-difference-between-null-and-undefined-5h76
What is the difference between null and undefined? - DEV Community
March 12, 2023 - The convention in TypeScript is that undefined values have not been defined yet, whereas null values indicate intentional absence of a value.
🌐
Tektutorialshub
tektutorialshub.com › home › typescript › null vs undefined in typescript
Null Vs Undefined in TypeScript - Tektutorialshub
March 15, 2023 - This is a very old bug in JavaScript · The only value that you can assign to an undefined variable is undefined. You can assign null only if StrictNullCheck is disabled). Any other values like string, object, numbers, etc are not allowed. The only value that you can assign to it is null. You can also assign undefined only if StrictNullCheck is disabled. Both null & undefined is falsy value in TypeScript...
Find elsewhere
🌐
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 - When a javascript object is being serialized, all undefined properties are discarded, remember 'undefined' means a property is yet to be assigned a value. But null on the other hand is known by JSON as its a valid JSON data type
🌐
GitHub
yellowduck.be › posts › null-vs-undefined-in-typescript-and-javascript-whats-the-difference
🐥 Null vs. Undefined in TypeScript and JavaScript: what's the difference?
Understanding null and undefined helps in writing clearer and more predictable code. While undefined typically signifies an uninitialized value, null is used for explicitly clearing or indicating the absence of a value.
🌐
Medium
medium.com › @o_o_o › null-vs-undefined-can-i-use-only-one-a3b7db5468f2
null vs. undefined: Can I use only one? | by OOO | Medium
March 29, 2022 - In older browsers, it was possible to overwrite undefined because it is not a reserved word unlike null. So it leads to side effect if you do this: But in modern browsers (JavaScript 1.8.5 / Firefox 4+), undefined is a non-configurable, non-writable property, per the ECMAScript 5 specification. So it’s no longer a problem if you’re using “modern browser”. And there’re already some guys doing it: Typescript team only uses undefined and Douglas Crockford stopped using null.
🌐
HowToDoInJava
howtodoinjava.com › home › typescript › difference between undefined and null
JavaScript - Difference between undefined and null
September 22, 2021 - JavaScript, TypeScript Basics · In JavaScript, a variable is said to be “undefined” if it has been declared but not initialized. Whereas “null” is assigned to a variable whose value is absent at the time of initialization.
🌐
GitHub
github.com › microsoft › TypeScript › issues › 9653
Guidelines for choosing between `null` and `undefined` with `strictNullChecks` · Issue #9653 · microsoft/TypeScript
June 10, 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: ...
Published   Jul 12, 2016
🌐
GeeksforGeeks
geeksforgeeks.org › typescript › how-to-check-null-and-undefined-in-typescript
How to check null and undefined in TypeScript ? - GeeksforGeeks
July 23, 2025 - To make a variable null we must assign null value to it as by default in typescript unassigned values are termed undefined. We can use typeof or '==' or '===' to check if a variable is null or undefined in typescript.
🌐
Javatpoint
javatpoint.com › null-vs-undefined
Difference Between Null and Undefined - javatpoint
In TypeScript, TypeScript compiler infers the type information when: Variables and members are initialized Setting default values for... ... We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks ... Java Data Structures C Programming C++ Tutorial C# Tutorial PHP Tutorial HTML Tutorial JavaScript Tutorial jQuery Tutorial Spring Tutorial
🌐
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 - An undefined value may indicate the value should not be updated. If an argument isn’t needed at every call site I’ll make it optional OR give it a default value if there is one that makes sense. If an argument should accept null then I’ll allow null by adding | null to its type.
🌐
DEV Community
dev.to › andreasbergqvist › typescript-undefined-vs-null-3a22
TypeScript - undefined vs null - DEV Community
April 8, 2019 - The difference between an actually undefined variable vs a variable set to null is lost. JSON can only handle null and not undefined.