fix(base-ui): HoverCard delay props break the build on a Base UI project - #473
fix(base-ui): HoverCard delay props break the build on a Base UI project#473hamchowderr wants to merge 1 commit into
Conversation
On a shadcn Base UI project (`init --base base`), `HoverCard` resolves to Base
UI's PreviewCard, which has neither `openDelay` nor `closeDelay`. Four elements
name those props in a typed position, so `tsc` fails before anything renders:
attachments.tsx AttachmentHoverCard 3 errors
prompt-input.tsx PromptInputHoverCard 3 errors
inline-citation.tsx InlineCitationCard 1 error
context.tsx Context 1 error
attachments.tsx(375,3): error TS2339: Property 'openDelay' does not exist on
type 'Props<unknown>'.
inline-citation.tsx(53,14): error TS2322: Type '{ ...; openDelay: number; }'
is not assignable to type 'IntrinsicAttributes & Props<unknown>'.
Reported in vercel#446 for attachments and prompt-input; inline-citation and context
have the same defect.
Each component now spreads a NO_DELAY object rather than naming the props. Radix
keeps the zero-delay behaviour, Base UI ignores the extra keys instead of failing
to compile, and a caller's own props still win because they spread last.
AttachmentHoverCard and PromptInputHoverCard previously destructured
`openDelay = 0, closeDelay = 0` out of props. Their prop type is
`ComponentProps<typeof HoverCard>`, so on Radix those keys came from HoverCard's
own type and callers can still pass them — the defaults are unchanged. On Base UI
the keys were never in the type, so nothing that compiled before stops compiling.
This does not address the other Base UI failures in vercel#446 — the four
`BaseUIEvent<...>` handler-signature errors in prompt-input.tsx are a real typing
change and are left alone here.
Verified on both bases: `tsc --noEmit` error count in packages/elements is
unchanged (56 before, 56 after — all pre-existing, in __tests__), none in these
four files, and 950 tests across 46 files pass.
|
@hamchowderr is attempting to deploy a commit to the Vercel Team on Vercel. A member of the Team first needs to authorize it. |
|
Verified on an actual Base UI project, since the repo's own suite runs on Radix and can't exercise this. Scaffolded Before — 15 errors: After — 7: All 8 The 7 survivors are the ones this PR deliberately doesn't touch:
No new errors introduced. On the Radix side, |
Fixes the
openDelay/closeDelayhalf of #446, and covers two files that issue doesn't mention.The problem
On a shadcn Base UI project (
shadcn init --base base),HoverCardresolves to Base UI'sPreviewCard, which has neitheropenDelaynorcloseDelay. Four elements name those props in a typed position, sotscfails before anything renders:attachments.tsxAttachmentHoverCardprompt-input.tsxPromptInputHoverCardinline-citation.tsxInlineCitationCardcontext.tsxContext#446 reports this for
attachmentsandprompt-input;inline-citationandcontexthave the same defect and aren't mentioned there.The fix
Each component spreads a
NO_DELAYobject instead of naming the props:Radix keeps the zero-delay behaviour, Base UI ignores the extra keys rather than failing to compile, and a caller's own props still win because they spread last.
On the two that took them as props
AttachmentHoverCardandPromptInputHoverCardpreviously destructuredopenDelay = 0, closeDelay = 0. Their prop type isComponentProps<typeof HoverCard>, so on Radix those keys came from HoverCard's own type and callers can still pass them — the defaults are unchanged. On Base UI the keys were never in the type, so nothing that compiled before stops compiling.Scope
This does not address the rest of #446. The four
BaseUIEvent<…>handler-signature errors inprompt-input.tsxare a real typing change and are deliberately left alone, as is theButtonPropsmismatch inplan.tsx.Verification
tsc --noEmitinpackages/elements: 56 errors before, 56 after — all pre-existing and in__tests__; none in these four filesvitest run: 950 tests across 46 files pass🤖 Generated with Claude Code