resolvable-value
v1.0.2
Published
Resolves functions and promises to a value with TypeScript type safety
Downloads
18,321
Readme
resolvable-value
Use it when you want to take an argument that may be a Promise
or may be a function
or async function
that returns a value of a given type.
Install
# Yarn
$ yarn add resolvable-value
# NPM
$ npm install --save resolvable-value
Usage
import { Resolvable, resolve } from "resolvable-value"
async function logResolvableValue(resolvableString: Resolvable<string>) {
const value = await resolve(resolvableString)
console.log(value)
}