Types

This lesson covers the key features of TypeScript's type system.

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...

Enums

An enum is a collection of named constants.

Loading TypeScript...

Conditional Types

Was this page helpful?