Sha256: 2d3f23c577a913d0f396184f31998507e18c8712bc74303a433cf47f94fd7e07
Contents?: true
Size: 691 Bytes
Versions: 28
Compression:
Stored size: 691 Bytes
Contents
type AsyncFunction = (...arguments_: any[]) => Promise<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>>;
Version data entries
28 entries across 28 versions & 2 rubygems