wiki/content/20201124091530-typescript_strictnullchecks.md

255 B

date id title
20201124 40929849-a8dc-4293-8e24-afa2ff04620d TypeScript strictNullChecks

Description

Check if variable is null

Syntax

function foo(a?: number | null) {
  if (a == null) return;

  // a is number now.
}