UNPKG

es-promise-ext

Version:

Native promise extensions for javascript and typescript.

17 lines (16 loc) 520 B
export type func<T> = () => T; /** * Start promise with a function, which Promise.resolve() does not support. * * @param {T} value * - a value - which would be equivient to Promise.resolve(value) * - a function which will be called and pass the result in promise * * @return {Promise<T>} * A value within a promise * * @example * promiseThen(3) // return 3 in a promise * promiseThen(()=>3) // return 3 in a promise */ export default function then<T>(value: T | PromiseLike<T> | func<T>): Promise<T>;