Рет қаралды 127
Type Predicates are a lesser known pattern, but they are able to provide an incredible boost of developer experience specially when consuming external libraries. Before adding assertions to your code, consider using a Type Guard with predicates instead!
00:00 - Hello
01:15 - Type Assertions may be a bug bomb 🪲
01:45 - Better guards with Predicates instead of Assertions ✨
02:05 - Boolean check + Assertion ⚡️
02:22 - Code setup
02:52 - Default inference - too wide
03:28 - Assertion to the... rescue (?)
03:40 - Oh noes! My assertion is now wrong! 💥
03:58 - Coding the Type Guard ✨
04:46 - Breaking it down one last time
05:08 - Remember to Subscribe 😉