8 lines
270 B
TypeScript
8 lines
270 B
TypeScript
/*
|
|
Prevents unhandled promise rejections from being thrown.
|
|
Follows https://jakearchibald.com/2023/unhandled-rejections
|
|
*/
|
|
export function preventUnhandledRejections(...promises: Promise<unknown>[]) {
|
|
for (const promise of promises) promise.catch(() => {});
|
|
}
|