(promise: Promise<unknown> | Thenable<unknown>)
| 92 | * should not be considered part of the public API. |
| 93 | */ |
| 94 | export function tryResolveSync(promise: Promise<unknown> | Thenable<unknown>) { |
| 95 | let data: unknown |
| 96 | |
| 97 | promise |
| 98 | .then((result) => { |
| 99 | data = result |
| 100 | return result |
| 101 | }, noop) |
| 102 | // .catch can be unavailable on certain kinds of thenable's |
| 103 | // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition |
| 104 | ?.catch(noop) |
| 105 | |
| 106 | if (data !== undefined) { |
| 107 | return { data } |
| 108 | } |
| 109 | |
| 110 | return undefined |
| 111 | } |
no outgoing calls
no test coverage detected
searching dependent graphs…