...
/Type Checking an Interface with Custom User-Defined Type Guard
Type Checking an Interface with Custom User-Defined Type Guard
This lesson shows a way to type check by manually building an algorithm that aims to find unique characteristics in the structure.
We'll cover the following...
User-defined function
A custom user-defined type guard is a function that checks specific parts of the structure of an object to determine if it is one type or another. The advantage is that the type does not need to be altered with a branded property or used with a discriminator. However, it comes with the cost of foregoing functions that check every type.
The following code has ...