From 96c694da1132bfbb3e05c4d894bc38372e25bb6d Mon Sep 17 00:00:00 2001 From: Sora Morimoto Date: Thu, 23 Oct 2025 15:52:26 +0900 Subject: [PATCH 1/2] Fix type error in `InlineCitationCardTrigger` by checking `sources[0]` directly Change the condition from `sources.length` to `sources[0]` to ensure TypeScript recognises that `sources[0]` is defined when passed to the URL constructor. This resolves the `string | undefined` is not assignable to `string | URL` type error. Signed-off-by: Sora Morimoto --- packages/elements/src/inline-citation.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/elements/src/inline-citation.tsx b/packages/elements/src/inline-citation.tsx index 27fd0213..1f49b828 100644 --- a/packages/elements/src/inline-citation.tsx +++ b/packages/elements/src/inline-citation.tsx @@ -68,7 +68,7 @@ export const InlineCitationCardTrigger = ({ variant="secondary" {...props} > - {sources.length ? ( + {sources[0] ? ( <> {new URL(sources[0]).hostname}{" "} {sources.length > 1 && `+${sources.length - 1}`} From 869fa20af87e15f5142c193a2b576dc07411e881 Mon Sep 17 00:00:00 2001 From: Hayden Bleasel Date: Mon, 27 Oct 2025 18:41:13 -0700 Subject: [PATCH 2/2] Create proud-rocks-study.md --- .changeset/proud-rocks-study.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/proud-rocks-study.md diff --git a/.changeset/proud-rocks-study.md b/.changeset/proud-rocks-study.md new file mode 100644 index 00000000..8c99d123 --- /dev/null +++ b/.changeset/proud-rocks-study.md @@ -0,0 +1,5 @@ +--- +"ai-elements": patch +--- + +Fix type error in InlineCitationCardTrigger by checking sources[0] directly