fix(Button): allow inline event handlers with non-void return types#239
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Upstream
269080a—fix(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) => voidononClick/onSubmit. Counter-intuitively this widens what callers may pass: TypeScript's void-return bivalence means a function returning anything is assignable to a=> voidparameter, so inline template handlers whose expression returns a non-void value (e.g.@click="count++") are accepted instead of erroring against thevoid | 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'sBlogPost.vue/ChangelogVersion.vueare absent in b24ui (N/A).Deviation — b24ui extension
b24ui's
Badge.vueis clickable and has anonCloseClick?: ((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
.sync/log/269080a….md— port rationale.sync/nuxt-ui.json— add269080aasport, advance cursor; reconcile priordfbbfeb→ PR chore(sync): defer upstream AI SDK v7 migration (dfbbfeb) #238 /a2c59cf0. (269080aitself stayspending-merge, reconciled next port.)🤖 Generated with Claude Code
Generated by Claude Code