null & undefined
TS · Basic Typeslet varName: null = null;
let varName: undefined = undefined;
let varName: string | null = null;let resetValue: null = null;
let notAssigned: undefined = undefined;
// Practical usage - nullable types
let selectedUserId: string | null = null;
selectedUserId = "usr_482";// selectedUserId can hold either a string or nullNote With strictNullChecks enabled (recommended), null and undefined are NOT assignable to other types unless you explicitly include them in a union. This catches a huge class of runtime bugs.