import { type ResolveFunction } from "https://deno.land/x/deno@v0.28.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.