Search⌘ K
AI Features

Type Constructors

Understand type constructors in TypeScript, which act like functions taking types as input and returning new types. Learn how generic interfaces function as type-transforming functions and discover built-in advanced types such as NonNullable, Partial, and ReturnType. This lesson enhances your grasp of generics and prepares you for more complex typing scenarios.

We'll cover the following...

Two worlds

Type constructor is a function (not a regular function, a mathematical function) that takes a type and returns a new type (based on the original type).

Notice that a generic interface with only one type argument is exactly that. For example, the FormField type from the previous lesson is a function with one type argument, T. It takes a type (e.g. string ...