1 min read 88 words Updated Oct 03, 2026 Created Oct 03, 2026
#Programming#TypeScript#review

Compared to Programming languages/Rust/Rust or Kotlin TypeScript also offers optional null-safety, but only at compile time. Thus, at execution, null-related errors are still possible.

strictNullChecks is true, if strict is true in tsconfig.

Useful features of TypeScript for writing null-safe code:

Optional Chaining:

const length = name?.length; // `undefined`, if `name` null/undefined

Nullish Coalescing:

const result = name ?? "default";

Type Guards:

if (typeof name === "string") {
  // name is guaranteed to be a string 
}

Utility types:

NonNullable oder Partial