Compound type guard for agent message chunks with text content.
Combines isAgentMessageChunk and content.type === "text" into a single guard. After narrowing, update.content.text is typed as string.
isAgentMessageChunk
content.type === "text"
update.content.text
string
The session update to test.
true if u is an AgentTextChunkUpdate.
true
u
conn.onSessionUpdate((sessionId, update) => { if (isAgentTextChunk(update)) { console.log(update.content.text); // string, no further checks needed }}); Copy
conn.onSessionUpdate((sessionId, update) => { if (isAgentTextChunk(update)) { console.log(update.content.text); // string, no further checks needed }});
Compound type guard for agent message chunks with text content.
Combines
isAgentMessageChunkandcontent.type === "text"into a single guard. After narrowing,update.content.textis typed asstring.