InterviewSolution
Saved Bookmarks
| 1. |
How to enforce strict null checks in TypeScript? |
|
Answer» Null pointers are ONE of the most common sources of unexpected runtime errors in programming. TYPESCRIPT HELPS you avoid them to a large degree by enforcing strict null checks. You can enforce strict null checks in two ways:
When the flag is false, TypeScript IGNORES null and undefined values in the code. When it is true, null and undefined have their distinct types. The compiler throws a type error if you try to use them where a concrete value is expected. |
|