The ReturnType utility type allows for the extraction of the return type of a function. ReturnType takes as an argument a the function type.

Structure

ReturnType<Type>

Example

function modulo(n: number): number {
	return n%2
}

type mReturnType = ReturnType<typeof modulo> //type mReturnType = number

``