Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Get Promise state
export const promiseState = async (p: Promise<any>): Promise<string> => {
const t = {};
return await Promise.race([p, t]).then(
(v) => {
return (v === t)
? 'pending'
: 'fulfilled';
() => 'rejected');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.