persona-community-5/.pnpm-store/v3/files/cd/b459101db0fbf8fd68603e11eea343aca6bd57124eab36f348b0e7efaaada2ac844d0078a481b849e49f4e10e48c4f0a606372d94f63be701a3db910be6341
rdev-worker a1d0d1bf1c
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
build: /implement-feature community-ui --requirements 'Build the React commu...
2026-02-24 08:22:30 +00:00

24 lines
695 B
Plaintext

type AsyncFunction = (...arguments_: any[]) => PromiseLike<unknown>;
/**
Unwrap the return type of a function that returns a `Promise`.
There has been [discussion](https://github.com/microsoft/TypeScript/pull/35998) about implementing this type in TypeScript.
@example
```ts
import type {AsyncReturnType} from 'type-fest';
import {asyncFunction} from 'api';
// This type resolves to the unwrapped return type of `asyncFunction`.
type Value = AsyncReturnType<typeof asyncFunction>;
async function doSomething(value: Value) {}
asyncFunction().then(value => doSomething(value));
```
@category Async
*/
export type AsyncReturnType<Target extends AsyncFunction> = Awaited<ReturnType<Target>>;