Mastering TypeScript: Assert and Guard | packtpub.com

preview_player
Показать описание
This playlist/video has been uploaded for Marketing purposes and contains only introductory videos.

What is type assertion and type guarding and how can we use them appropriately?
• Check a simple example showing type guarding and then type assertion
• Look at the new syntax for type assertion
• Discuss when we should use a type assertion and when we should use a type guard

For the latest Web Development video tutorials, please visit

Рекомендации по теме
Комментарии
Автор

I recommend typically using the type guards instead of casts. If you use a type guard, you can be certain your code will work. If you use casts, you and the compiler aren't aware if your code will actually work, you just assume that it will.

bristolemotv