Skip to main content
The Deno 2 Release Candidate is here
Learn more
Module

x/deno/cli/js/util.ts>ResolveFunction

A modern runtime for JavaScript and TypeScript.
Go to Latest
type alias ResolveFunction
import { type ResolveFunction } from "https://deno.land/x/deno@v0.30.0/cli/js/util.ts";

A Resolvable is a Promise with the reject and resolve functions placed as methods on the promise object itself. It allows you to do:

  const p = createResolvable<number>();
  // ...
  p.resolve(42);

It'd be prettier to make Resolvable a class that inherits from Promise, rather than an interface. This is possible in ES2016, however typescript produces broken code when targeting ES5 code.

At the time of writing, the GitHub issue is closed in favour of a proposed solution that is awaiting feedback.

definition: (value?: T | PromiseLike<T>) => void