( action: Exclude<BackendAlertAction, 'get' | 'wait'>, result: BackendAlertResult, )
| 409 | } |
| 410 | |
| 411 | function normalizeAlertHandledResult( |
| 412 | action: Exclude<BackendAlertAction, 'get' | 'wait'>, |
| 413 | result: BackendAlertResult, |
| 414 | ): SystemAlertCommandResult { |
| 415 | if (result.kind !== 'alertHandled') { |
| 416 | throw new AppError( |
| 417 | 'COMMAND_FAILED', |
| 418 | `system.alert ${action} returned an invalid backend result`, |
| 419 | ); |
| 420 | } |
| 421 | return { |
| 422 | kind: 'alertHandled', |
| 423 | action, |
| 424 | handled: result.handled, |
| 425 | ...(result.alert ? { alert: result.alert } : {}), |
| 426 | ...(result.button ? { button: result.button } : {}), |
| 427 | ...successText(result.handled ? `Alert ${action}ed` : 'No alert handled'), |
| 428 | }; |
| 429 | } |
| 430 | |
| 431 | function isKeyboardResult(value: unknown): value is BackendKeyboardResult { |
| 432 | return Boolean(value && typeof value === 'object'); |
no test coverage detected
searching dependent graphs…