Skip to content

fix(Button): allow inline event handlers with non-void return types#239

Merged
IgorShevchik merged 1 commit into
mainfrom
sync/nuxt-269080a
Jul 3, 2026
Merged

fix(Button): allow inline event handlers with non-void return types#239
IgorShevchik merged 1 commit into
mainfrom
sync/nuxt-269080a

Conversation

@IgorShevchik

Copy link
Copy Markdown
Collaborator

Upstream

269080afix(Button): allow inline event handlers with non-void return types (#6668)

Change — 1:1

Narrows handler-prop types from (e) => void | Promise<void> to (e) => void on onClick/onSubmit. Counter-intuitively this widens what callers may pass: TypeScript's void-return bivalence means a function returning anything is assignable to a => void parameter, so inline template handlers whose expression returns a non-void value (e.g. @click="count++") are accepted instead of erroring against the void | Promise<void> union.

Applied in the b24ui-matching files (both the single-arg and Array<…>/() => … union variants): Button.vue (onClick), Form.vue (onSubmit), LinkBase.vue, PageCard.vue, PageFeature.vue, User.vue, vue/overrides/inertia/LinkBase.vue. Upstream's BlogPost.vue/ChangelogVersion.vue are absent in b24ui (N/A).

Deviation — b24ui extension

b24ui's Badge.vue is clickable and has an onCloseClick?: ((e) => void | Promise<void>) | Array<…> prop that upstream's Badge lacks. Same bug, same fix — applied there too for consistency.

8 files, +8/−8 (one line each).

Tests

Type-only change → no snapshot churn. Full suite unchanged (225 files, 5147 passed / 6 skipped).

Verify (CI=true)

dev:prepare · lint · typecheck · test · build — all green.

Ledger

🤖 Generated with Claude Code


Generated by Claude Code

Port of upstream nuxt/ui 269080a (#6668).

Narrow handler-prop types from `(e) => void | Promise<void>` to `(e) => void`
on onClick/onSubmit across Button, Form, LinkBase, PageCard, PageFeature, User
and the inertia LinkBase override. TypeScript's void-return bivalence means a
function returning anything is assignable to a `=> void` parameter, so inline
template handlers whose expression returns a non-void value are accepted instead
of erroring against the `void | Promise<void>` union.

Also applied to b24ui's clickable Badge `onCloseClick` (b24ui-only prop, same
pattern). Type-only; no snapshot changes.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JS8ypVfQSFzYVZzkTHhURb
@IgorShevchik IgorShevchik merged commit 394fca0 into main Jul 3, 2026
1 check passed
@IgorShevchik IgorShevchik deleted the sync/nuxt-269080a branch July 3, 2026 04:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants