remeda
Version:
A utility library for JavaScript and Typescript.
21 lines (19 loc) • 713 B
TypeScript
import { NarrowedTo } from "./NarrowedTo-DsKwS5hs.js";
//#region src/isPromise.d.ts
/**
* A function that checks if the passed parameter is a Promise and narrows its type accordingly.
*
* @param data - The variable to check.
* @returns True if the passed input is a Promise, false otherwise.
* @signature
* R.isPromise(data)
* @example
* R.isPromise(Promise.resolve(5)) //=> true
* R.isPromise(Promise.reject(5)) //=> true
* R.isPromise('somethingElse') //=> false
* @category Guard
*/
declare function isPromise<T>(data: Readonly<PromiseLike<unknown>> | T): data is NarrowedTo<T, PromiseLike<unknown>>;
//#endregion
export { isPromise };
//# sourceMappingURL=isPromise-BDVaDvDl.d.ts.map