contentBlockFromData
function contentBlockFromData(data): ContentBlock;Defined in: src/types/messages.ts:601
Converts ContentBlockData to a ContentBlock instance. Handles all content block types including text, tool use/result, reasoning, cache points, guard content, and media blocks.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
data | ContentBlockData | The content block data to convert |
Returns
Section titled “Returns”A ContentBlock instance of the appropriate type
Throws
Section titled “Throws”Error if the content block type is unknown