import { type AsyncReturnType } from "https://deno.land/x/actionify@0.3.0/src/deps/types.ts";
Unwrap the return type of a function that returns a Promise
.
There has been discussion about implementing this type in TypeScript.
Examples
Example 1
Example 1
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));
definition: PromiseValue<ReturnType<Target>>