Skip to main content
Module

x/scaffold/src/deps/types.ts>AsyncReturnType

scaffold your next project with style and 💗
Latest
type alias AsyncReturnType
import { type AsyncReturnType } from "https://deno.land/x/scaffold@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

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));

Type Parameters

Target extends AsyncFunction
definition: PromiseValue<ReturnType<Target>>