"Non-nullable types aim to solve the most common source of bugs in JavaScript, says Rosenwasser: null and undefined. Non-nullable types forbid assigning null to a variable, unless it is declared as an option type:"
let foo1: string = null; // Error!
let foo2: string | null = null; // Option type
No comments:
Post a Comment