* Type guard to check if a suggestion's metadata is a Command. * Commands have a name string and a type property.
(metadata: unknown)
| 84 | * Commands have a name string and a type property. |
| 85 | */ |
| 86 | function isCommandMetadata(metadata: unknown): metadata is Command { |
| 87 | return ( |
| 88 | typeof metadata === 'object' && |
| 89 | metadata !== null && |
| 90 | 'name' in metadata && |
| 91 | typeof (metadata as { name: unknown }).name === 'string' && |
| 92 | 'type' in metadata |
| 93 | ) |
| 94 | } |
| 95 | |
| 96 | /** |
| 97 | * Represents a slash command found mid-input (not at the start) |
no outgoing calls
no test coverage detected