Type predicate
Any function can be defined as a "type guard", which performs some validation and returns
a type predicate. For example, we can implement a function which checks for NaN
values during
runtime, and allows you to safely assume in your TypeScript program that the number
type does
not apply to invalid numbers.
Loading TypeScript...