(error: unknown)
| 3 | } |
| 4 | |
| 5 | const isErrorWithMessage = (error: unknown): error is ErrorWithMessage => { |
| 6 | return ( |
| 7 | typeof error === 'object' && error !== null && 'message' in error && typeof (error as Record<string, unknown>).message === 'string' |
| 8 | ) |
| 9 | } |
| 10 | |
| 11 | const toErrorWithMessage = (maybeError: unknown): ErrorWithMessage => { |
| 12 | if (isErrorWithMessage(maybeError)) return maybeError |
no outgoing calls
no test coverage detected