The in TypeScript is a utility type that is quite similar to the . It lets you take the return output of a function, and construct a type based on it. ReturnType ParameterType Utility Type ReturnType The 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. ReturnType Let's look at a silly example to put it into context. Below, we define a new type, which has two properties, , and , both of which are numbers. A function then turns all numbers on this object into strings and returns a new type. We define a custom type, called , which expects and to be strings. a b Data a b function sendData(a: number, b: number) { return { a: `${a}`, b: `${b}` } } type Data = { a: string, b: string } function consoleData(data:Data) { console.log(JSON.stringify(data)); } let stringifyNumbers = sendData(1, 2); consoleData(stringifyNumbers); Since expects data to be of format , TypeScript throws an error if or are numbers. Our function fixes that, by converting and to strings. consoleData Data a b sendData a b The issue with this setup is if we added or changed , or our input data, then would need to be updated too. That's not a big deal, but it's an easy source of bugs. As such, we can instead use to simplify our type declaration. Our type can be written like this: sendData Data ReturnType Data function sendData(a: number, b: number) { return { a: `${a}`, b: `${b}` } } type Data = ReturnType<typeof sendData> // The same as writing: // type Data = { // a: string, // b: string // } Since returns data in type , becomes that type. It means we don't have to maintain two copies of the output from - instead, we have one, inside the function, and a type that conforms to that, simplifying our code. sendData { a: string, b: string } Data sendData Also Published Here