Extract a function’s return type.
Section: Utility Types
Use `ReturnType<T>`
typescript
typescript
function createUser() {
return { id: 1, name: "Ada" };
}
type User = ReturnType<typeof createUser>;Explanation
Useful when you want a type that stays synced with a function implementation.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing Utility Types