TypeScript tutorialLesson 19Free preview
TS Null
This lesson is part of TypeScript · All levels
Summary
TypeScript can treat null and undefined strictly through the strictNullChecks option. With this mode, the possible values of the voids should be checked first using optional chaining or nullish coalescing. Such an approach prevents classic errors such as reading properties from the value null.
Key points
- StrictNullChecks separates the empty type from the normal type
- Optional chaining wear?
- Nullish coalescing?? gives the default value
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.