After updating to v0.22.0 from v0.20.9, I'm getting a type error on the last line of this block (text = msg.content[0].text;):
const msg = await anthropic.messages.create({
model: "claude-3-opus-20240229",
max_tokens: maxOutputTokens,
temperature: 0.9,
messages: [
{
role: "user",
content: [
{
type: "text",
text: prompt,
},
],
},
],
});
text = msg.content[0].text;
The type error is:
Property 'text' does not exist on type 'ContentBlock'.
Property 'text' does not exist on type 'ToolUseBlock'.ts(2339)
When logging the message content, it does not appear to have changed, so I'm guessing this is just a type bug that needs fixed. My code works as expected when adding the // @ts-ignore comment above the problem line, which is my current workaround.
After updating to
v0.22.0fromv0.20.9, I'm getting a type error on the last line of this block (text = msg.content[0].text;):The type error is:
When logging the message content, it does not appear to have changed, so I'm guessing this is just a type bug that needs fixed. My code works as expected when adding the
// @ts-ignorecomment above the problem line, which is my current workaround.