Skip to content

Instantly share code, notes, and snippets.

@igolka97
Created August 4, 2024 17:21
Show Gist options
  • Save igolka97/9e4bdd157b9759525c342439a9e347a8 to your computer and use it in GitHub Desktop.
Save igolka97/9e4bdd157b9759525c342439a9e347a8 to your computer and use it in GitHub Desktop.
Fulfilled promise TypeScript assertion
export function assertFulfilled<T>(
item: PromiseSettledResult<T>,
): item is PromiseFulfilledResult<T> {
return item.status === 'fulfilled';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment