TypeScript tutorialLesson 39Free preview
TS Error Handling
This lesson is part of TypeScript · All levels
Summary
TypeScript error handling uses try, catch, throw, and finally like JavaScript, with additional type information. In strict mode, the catch value is unknown so it is mandatory to check before its properties are read. A good practice is to take context and throw out descriptive errors.
Key points
- Use try catch to handle the exception
- The catch value of the unknown type on the strict mode
- Narrowing with Error before reading message
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.