You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
In the following scenario:
<script setup lang="ts">
import type { MyGenericObject } from '@/types' // MyGenericObject extends GenericObject
function onSubmit(values: MyGenericObject) {}
</script>
<template>
<Form v-slot="{ handleSubmit }">
<form @submit.prevent="handleSubmit($event, onSubmit)"></form>
</Form>
</template>
My type checker doesn't agree with me defining the values param of the onSubmit function param as anything else than GenericObject and this because FormSlotProps is not generic and its property handleSubmit is defined strictly as SubmissionHandler (with no generic params)
Describe the solution you'd like
I would like to be able to define my submission handler as previously described without type checker error.
There is same problem with onSubmit event of Form because type is PropType<SubmissionHandler<GenericObject>>. It makes Form kinda useless in typescript:
<script setup lang="ts">
interfaceMyForm {}const onSubmit:SubmissionHandler<MyForm> = (values) => {}
</script>
<template>
<!-- type error here -->
<Form@submit=onSubmit />
</template>
Is your feature request related to a problem? Please describe.
In the following scenario:
My type checker doesn't agree with me defining the
values
param of theonSubmit
function param as anything else thanGenericObject
and this becauseFormSlotProps
is not generic and its propertyhandleSubmit
is defined strictly asSubmissionHandler
(with no generic params)Describe the solution you'd like
I would like to be able to define my submission handler as previously described without type checker error.
Describe alternatives you've considered
I think redefining
to include generic params should do the trick
The text was updated successfully, but these errors were encountered: