Use the built-in ReturnType utility with typeof: type User = ReturnType<typeof createUser>;. For the argument types use Parameters<typeof fn> (a tuple, so Parameters<typeof fn>[0] is the first one), and for an async function wrap it in Awaited: Awaited<ReturnType<typeof loadOrder>> is the value the promise resolves to.
A function's inferred return type is often the most accurate description of a value you have, and writing it out again as an interface means keeping two copies in sync. TypeScript ships utility types that read a function's signature for you: ReturnType for the result, Parameters for the arguments, Awaited to unwrap a promise, and ConstructorParameters and InstanceType for classes. They all work on types, so you hand them typeof fn, never the function itself. The sections below cover each one, the error you get without typeof, and the two cases where the result surprises people: generic and overloaded functions. Each example runs on this page: hit Run, then edit the code and run it again.
1ReturnType<typeof fn>Recommended
ReturnType<T> takes a function type and gives back what it returns. A function declaration is a value, so typeof createUser first turns it into its type, (name: string, admin: boolean) => { … }, and ReturnType takes the part after the arrow. The function below has no return annotation; its inferred object type becomes User, and any field added to createUser later shows up on User with no second edit. Arrow functions and function expressions work the same way.
// No return type written: TypeScript infers it from the object literal function createUser(name: string, admin: boolean) { return { id: name.toLowerCase(), name, roles: admin ? ["admin", "editor"] : ["viewer"], joined: new Date(Date.UTC(2026, 10, 19)), }; } // typeof turns the function into a type, ReturnType takes its result type User = ReturnType<typeof createUser>; // User follows createUser: add a field there and it exists here too function describe(user: User): string { const day = user.joined.toISOString().slice(0, 10); return `${user.name} (${user.id}): ${user.roles.join(", ")}, since ${day}`; } const users: User[] = [createUser("Ada", true), createUser("Linus", false)]; for (const u of users) { console.log(describe(u)); } // Arrow functions work the same way const toSlug = (title: string) => title.trim().toLowerCase().replace(/\s+/g, "-"); type Slug = ReturnType<typeof toSlug>; // string const slug: Slug = toSlug(" Get the Return Type "); console.log(slug);
Output
It prints Ada (ada): admin, editor, since 2026-11-19, Linus (linus): viewer, since 2026-11-19 and get-the-return-type. The type the checker derived for User is { id: string; name: string; roles: string[]; joined: Date; }. A function that can return undefined, such as one that returns array.find(…), gives { … } | undefined with strictNullChecks on (part of strict, as in most projects), so reading a property of it fails with error TS18048: 'user' is possibly 'undefined'. until you check it (see check for null or undefined). This page's compiler runs without strict, so here the | undefined is dropped.
2Parameters<typeof fn> for the argument types
Parameters<typeof fn> gives the argument types as a tuple, labels and optional markers included. Index it to get one argument: Parameters<typeof notify>[2] is the options object, which is handy when a library declares that type inline and never exports a name for it. Use the whole tuple as a rest parameter, ...args: Parameters<typeof notify>, and a wrapper accepts exactly what the original does, with no copy of the signature to drift out of date. For typing the callback itself rather than reading its types, see type a callback function.
function notify( userId: number, message: string, options: { channel: "sms" | "push"; retries?: number }, ) { const retries = options.retries ?? 0; // optional, so default it return `#${userId} via ${options.channel}, retries=${retries}: ${message}`; } // A tuple of all parameter types: [userId: number, message: string, options: ...] type NotifyArgs = Parameters<typeof notify>; // Index the tuple for one parameter, here the inline options type type NotifyOptions = Parameters<typeof notify>[2]; const urgent: NotifyOptions = { channel: "sms", retries: 3 }; console.log(notify(42, "Build failed", urgent)); // Rest parameters typed as the tuple keep notify's exact signature function notifyLater(...args: NotifyArgs): () => string { return () => notify(...args); } const queued = [ notifyLater(7, "Deploy finished", { channel: "push" }), notifyLater(9, "Disk at 91%", urgent), ]; for (const send of queued) { console.log(send()); } // A stored argument list type-checks against the tuple too const saved: NotifyArgs = [12, "Password changed", { channel: "push", retries: 1 }]; console.log(notify(...saved));
Output
The four calls print #42 via sms, retries=3: Build failed, #7 via push, retries=0: Deploy finished, #9 via sms, retries=3: Disk at 91% and #12 via push, retries=1: Password changed. The tuple type is [userId: number, message: string, options: { channel: "sms" | "push"; retries?: number; }], so a stored argument list is checked like a call: a wrong channel gives error TS2322: Type '"email"' is not assignable to type '"sms" | "push"'., and a list with two elements fails with Source has 2 element(s) but target requires 3.
3Awaited for async functions
An async function always returns a promise, so ReturnType<typeof loadOrder> is Promise<{ … }>, not the order. Wrap it in Awaited, built in since TypeScript 4.5, to get the type that await produces: Awaited<ReturnType<typeof loadOrder>>. Awaited unwraps nested promises all the way down and returns any other type unchanged, which is exactly what await does at runtime. The async code sits in a main() function because this compiler builds CommonJS, which has no top-level await.
// An async function always returns a Promise async function loadOrder(id: number) { // Stand-in for a database or HTTP call await new Promise((resolve) => setTimeout(resolve, 10)); return { id, items: ["keyboard", "mouse"], total: 68 }; } // ReturnType gives Promise<{ id: number; ... }>; Awaited unwraps it type OrderPromise = ReturnType<typeof loadOrder>; type Order = Awaited<ReturnType<typeof loadOrder>>; function receipt(order: Order): string { return `Order ${order.id}: ${order.items.length} items, $${order.total}`; } // Awaited unwraps nested promises and leaves other types alone type Deep = Awaited<Promise<Promise<number>>>; // number type Plain = Awaited<string>; // string async function main() { const pending: OrderPromise = loadOrder(7); console.log(pending instanceof Promise); const order: Order = await pending; console.log(receipt(order)); const answer: Deep = await Promise.resolve(Promise.resolve(42)); const label: Plain = "done"; console.log(answer, label); } main();
Output
It prints true (the call really returns a promise), then Order 7: 2 items, $68 and 42 done. The two types are Promise<{ id: number; items: string[]; total: number; }> and { id: number; items: string[]; total: number; }. Forget the Awaited and the first property access fails with error TS2339: Property 'id' does not exist on type 'Promise<{ id: number; items: string[]; total: number; }>'. For the runtime side of awaiting many calls at once, see use async/await with Array.map.
4The "refers to a value" error: you need typeof
The most common mistake is passing the function itself: ReturnType<createUser>. Type arguments must be types, and createUser is a value, so the checker rejects it and the program never runs. This embed fails on purpose to show the message.
function createUser(name: string, admin: boolean) { return { id: name.toLowerCase(), name, admin }; } // Wrong: createUser is a value (a function), and ReturnType needs a type type User = ReturnType<createUser>; // Right: type User = ReturnType<typeof createUser>; const user: User = createUser("Ada", true); console.log(user.id);
Output
The compiler reports error TS2749: 'createUser' refers to a value, but is being used as a type here. Did you mean 'typeof createUser'? and the fix is in the message. Two relatives of this error: calling the function inside the type, ReturnType<typeof createUser()>, is a syntax error (error TS1005: '>' expected.), because typeof in a type takes a name, not an expression. And passing something that isn't a function, such as an object or a class instance type, gives error TS2344: Type '{ port: number; }' does not satisfy the constraint '(...args: any) => any'.
5Methods, classes and constructors
A class name is also a type, the type of its instances, so a method's type is an indexed access: ReturnType<Cart["totals"]> and Parameters<Cart["add"]>, no typeof needed. The constructor is the other way round. It lives on the class value, so the constructor utilities take typeof Cart: ConstructorParameters<typeof Cart> is the new arguments and InstanceType<typeof Cart> is what new returns. When you only have an instance, typeof cart.totals works too.
class Cart { private lines: { sku: string; qty: number; price: number }[] = []; constructor(public readonly owner: string, public currency: "USD" | "EUR" = "USD") {} add(sku: string, qty: number, price: number): this { this.lines.push({ sku, qty, price }); return this; } totals() { const count = this.lines.reduce((sum, l) => sum + l.qty, 0); const amount = this.lines.reduce((sum, l) => sum + l.qty * l.price, 0); return { count, amount, currency: this.currency }; } } // Methods: index the class type by the method name type Totals = ReturnType<Cart["totals"]>; type AddArgs = Parameters<Cart["add"]>; // Constructors: typeof Cart is the class itself, not an instance type CartArgs = ConstructorParameters<typeof Cart>; // [owner: string, currency?: ...] type CartInstance = InstanceType<typeof Cart>; // the same type as Cart function openCart(...args: CartArgs): CartInstance { return new Cart(...args); } function format(t: Totals): string { return `${t.count} items, ${t.amount.toFixed(2)} ${t.currency}`; } const cart = openCart("ada", "EUR"); const line: AddArgs = ["cable", 2, 4.5]; cart.add(...line).add("hub", 1, 23); console.log(format(cart.totals())); // From a value instead of a class: typeof on the instance's method const summary: ReturnType<typeof cart.totals> = openCart("linus").totals(); console.log(format(summary));
Output
It prints 3 items, 32.00 EUR and 0 items, 0.00 USD. Totals is { count: number; amount: number; currency: "USD" | "EUR"; } and CartArgs is [owner: string, currency?: "USD" | "EUR"], with the default value turned into an optional element. Mixing the two forms up gives TS2344: ReturnType<Cart> fails because an instance is not a function, and InstanceType<Cart> fails with Type 'Cart' does not satisfy the constraint 'abstract new (...args: any) => any'.
6Generic and overloaded functions
Two kinds of function give a ReturnType you may not expect. A generic function has no single return type, so ReturnType fills the type parameter with its constraint, unknown when there is none. Since TypeScript 4.7 an instantiation expression picks the type argument first: ReturnType<typeof tagged<Date>>. An overloaded function has several signatures, and ReturnType and Parameters read only the last one declared. To get another overload, write that signature out as a function type, or reorder the overloads if the last one is the one you need most. For writing overloads, see overload a function.
// A generic function: ReturnType cannot know T, so it uses unknown function tagged<T>(value: T) { return { value, tag: typeof value }; } type AnyTagged = ReturnType<typeof tagged>; // { value: unknown; tag: ... } // An instantiation expression (TypeScript 4.7+) fixes T first type TaggedDate = ReturnType<typeof tagged<Date>>; // { value: Date; tag: ... } const loose: AnyTagged = tagged("hello"); const exact: TaggedDate = tagged(new Date(Date.UTC(2026, 0, 31))); // value is unknown on loose, so narrow it before using it as a string if (typeof loose.value === "string") { console.log(loose.value.toUpperCase(), loose.tag); } // value is a Date on exact, so Date methods type-check directly console.log(exact.value.getUTCMonth() + 1, exact.tag); // Overloads: ReturnType and Parameters read the LAST signature only function parse(input: string): number; function parse(input: string[]): number[]; function parse(input: string | string[]): number | number[] { return Array.isArray(input) ? input.map(Number) : Number(input); } type Parsed = ReturnType<typeof parse>; // number[], from the last overload const many: Parsed = parse(["1", "2", "3"]); console.log(many); // For another overload, write the signature you want out yourself type ParseOne = (input: string) => number; const one: ReturnType<ParseOne> = parse("7"); console.log(one);
Output
It prints HELLO string, 1 object, [ 1, 2, 3 ] and 7. AnyTagged has value: unknown, which is why the code narrows with typeof before calling toUpperCase, while TaggedDate has value: Date. Parsed is number[], so assigning parse("7") to it fails with error TS2322: Type 'number' is not assignable to type 'number[]'., and Parameters<typeof parse> is [input: string[]], the last overload again.
7Which utility for which job?
| Method | Gives you | Pass it | Best for |
|---|---|---|---|
| ReturnType<typeof fn> | The return type | A function type (typeof fn, Class["method"]) | Naming an inferred result |
| Parameters<typeof fn> | A tuple of argument types | A function type | Wrappers, one argument via [i] |
| Awaited<ReturnType<typeof fn>> | The resolved value | Any type (promises are unwrapped) | async functions, TypeScript 4.5+ |
| ConstructorParameters / InstanceType | new arguments / the instance | typeof Class | Factories and class wrappers |
| ReturnType<typeof fn<T>> | One instantiation of a generic | typeof fn with type arguments | Generic functions, TypeScript 4.7+ |
Frequently asked questions
How is ReturnType defined in TypeScript?
It is a conditional type with infer in the standard library: type ReturnType<T extends (...args: any) => any> = T extends (...args: any) => infer R ? R : any;. TypeScript matches the function type against the pattern and binds whatever sits in the return position to R. Parameters is the same idea with infer P in the argument position, and you can write your own the same way, for example type ElementOf<T> = T extends readonly (infer E)[] ? E : never;.
How do I get the type of a single function parameter?
Index the Parameters tuple: Parameters<typeof notify>[0] is the first argument's type and Parameters<typeof notify>[2] the third. This is the usual way to name an options object that a library declares inline and does not export. For a method, use Parameters<MyClass["method"]>[0].
How do I unwrap the type of a Promise?
Use Awaited<T>: Awaited<Promise<string>> is string, nested promises are unwrapped all the way, and a type that is not a promise comes back unchanged. For an async function combine it with ReturnType: Awaited<ReturnType<typeof loadOrder>>. Before TypeScript 4.5 people wrote T extends Promise<infer U> ? U : T by hand, which only unwraps one level.
Can I get the return type of a function without calling it?
Yes. ReturnType<typeof fn> is computed by the type checker from the signature and disappears when the code is compiled, so the function never runs. That also means it cannot see runtime values: a function typed to return string may still return undefined at runtime if its data came from outside unchecked.
Why is ReturnType of my generic function unknown?
A generic function returns a different type for each call, and typeof fn describes all of them at once, so ReturnType replaces the type parameter with its constraint, or unknown without one. Pick a type argument first with an instantiation expression, ReturnType<typeof tagged<Date>> (TypeScript 4.7+), or call the function and take typeof of the result variable.
Should I declare the return type or derive it with ReturnType?
Declare it on public functions that other code depends on: an explicit interface documents the contract and makes a breaking change fail inside the function instead of at every caller. Derive it with ReturnType when the function is the real source of truth, such as factory functions, store or reducer setups and library functions whose result type is not exported, so the two never drift apart.
Run it yourself
Open any of these in the full TypeScript editor to tweak, run and share.
TypeScript playground