Become a member
to unlock all features

    Define Custom Type Guard Functions in TypeScript


    One aspect of control flow based type analysis is that the TypeScript compiler narrows the type of a variable within a type guard.

    This lesson explores how you can define functions and type predicates to create your own type guards similar to the Array.isArray() method.