1×
Become a member
to unlock all features
Autoplay

    Define Custom Type Guard Functions in TypeScript

    typescriptTypeScript
    ^2.0.0

    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.