Skip to content

feat(types): relax FormSubmitHandler generic constraint to object - #18

Merged
javipuche merged 1 commit into
mainfrom
feat/relax-submit-handler-constraint
Mar 11, 2026
Merged

javipuche merged 1 commit into
mainfrom
feat/relax-submit-handler-constraint

Conversation

@javipuche

Copy link
Copy Markdown
Member

Summary

  • Changes T extends Record<string, unknown> to T extends object in FormSubmitHandler<T>
  • Default remains Record<string, unknown> for backwards compatibility
  • Allows interfaces and class instances as T without requiring as unknown as Record<string, unknown> casts
// Before — required cast
const onSubmit: FormSubmitHandler<SignInValues as unknown as Record<string, unknown>>

// After — works directly
const onSubmit: FormSubmitHandler<SignInValues> = async (values, { setErrors }) => { ... }

Test plan

  • vue-tsc --noEmit passes (enforced by pre-commit hook)
  • Existing tests continue to pass

🤖 Generated with Claude Code

Allows interfaces and class instances as T without needing
`as unknown as Record<string, unknown>` casts.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@javipuche
javipuche merged commit 83af678 into main Mar 11, 2026
1 check passed
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.

1 participant