From 7403659b0652c5786f64bc5c5b4e49d7ee05b577 Mon Sep 17 00:00:00 2001 From: HamChowderr Date: Thu, 30 Jul 2026 11:08:51 -0700 Subject: [PATCH] fix(agent): narrow Tool description before rendering MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `Tool["description"]` from the `ai` package is `string | ((options) => string)`, so passing it straight to JSX fails to typecheck — a function is not a ReactNode: Type '(options: {...}) => string' is not assignable to type 'ReactNode' `??` only guards null/undefined, so a function description falls through to the JSX child. Narrow on `typeof === "string"` instead, which keeps the existing fallback for both undefined and function descriptions. Hit this consuming the registry: `shadcn add` an item that pulls `agent` into a project with `strict` on, and `next build` fails on this line. --- packages/elements/src/agent.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/elements/src/agent.tsx b/packages/elements/src/agent.tsx index 3b3fcdba..f1cdd57f 100644 --- a/packages/elements/src/agent.tsx +++ b/packages/elements/src/agent.tsx @@ -103,7 +103,9 @@ export const AgentTool = memo( {...props} > - {tool.description ?? "No description"} + {typeof tool.description === "string" + ? tool.description + : "No description"}