(content: Array<PreviewBlock>)
| 123 | * `contentBlocksPreviewText` returns. |
| 124 | */ |
| 125 | export type AttachmentPreviewLabel = |
| 126 | | { kind: 'filename'; filename: string } |
| 127 | | { kind: 'image' } |
| 128 | | { kind: 'attachment' }; |
| 129 | |
| 130 | export function contentBlocksAttachmentPreviewLabels( |
| 131 | content: Array<PreviewBlock> |
| 132 | ): AttachmentPreviewLabel[] { |
| 133 | return content |
| 134 | .filter( |
| 135 | (b): b is { type: 'attachment'; filename?: string; mimeType?: string } => |
| 136 | b.type === 'attachment' |
| 137 | ) |
| 138 | .map(a => |
| 139 | a.filename |
no test coverage detected