How the TypeScript ReturnType Works

The ReturnType in TypeScript is a utility type that is quite similar to the Parameters Type. It lets you take the return output of a function, and construct a type based on it.

The ReturnType Utility Type

The ReturnType utility type is very useful in situations where the output of a specific function needs to be taken in by another function. In that scenario, you might create a new, custom type, that the output of a function constrains itself to.

CategoriesUncategorized