From 30cf0f03c1bf67ea2ced1f5abba5eacf967a280e Mon Sep 17 00:00:00 2001 From: Kyle Filz Date: Wed, 22 Nov 2023 15:16:10 -0600 Subject: [PATCH 1/2] Fix Interia based useForm return types Requires inertiajs/inertia#1734 to be published to a new version. --- packages/react-inertia/src/index.ts | 2 +- packages/vue-inertia/src/index.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/react-inertia/src/index.ts b/packages/react-inertia/src/index.ts index fcfe801..badc26d 100644 --- a/packages/react-inertia/src/index.ts +++ b/packages/react-inertia/src/index.ts @@ -5,7 +5,7 @@ import { useRef } from 'react' export { client } -export const useForm = >(method: RequestMethod|(() => RequestMethod), url: string|(() => string), inputs: Data, config: ValidationConfig = {}): any => { +export const useForm = >(method: RequestMethod|(() => RequestMethod), url: string|(() => string), inputs: Data, config: ValidationConfig = {}) => { const booted = useRef(false) /** diff --git a/packages/vue-inertia/src/index.ts b/packages/vue-inertia/src/index.ts index 4250996..84e51ea 100644 --- a/packages/vue-inertia/src/index.ts +++ b/packages/vue-inertia/src/index.ts @@ -5,7 +5,7 @@ import { watchEffect } from 'vue' export { client } -export const useForm = >(method: RequestMethod|(() => RequestMethod), url: string|(() => string), inputs: Data, config: ValidationConfig = {}): any => { +export const useForm = >(method: RequestMethod|(() => RequestMethod), url: string|(() => string), inputs: Data, config: ValidationConfig = {}) => { /** * The Inertia form. */ From 6f6bf0fcaa1b2b3b9226fbb8876d0433906a3538 Mon Sep 17 00:00:00 2001 From: Kyle Filz Date: Thu, 23 Nov 2023 10:00:16 -0600 Subject: [PATCH 2/2] Make inertiaForm's more complex for TS to avoid TS4032 --- packages/vue-inertia/src/index.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/vue-inertia/src/index.ts b/packages/vue-inertia/src/index.ts index 84e51ea..84969fb 100644 --- a/packages/vue-inertia/src/index.ts +++ b/packages/vue-inertia/src/index.ts @@ -9,7 +9,8 @@ export const useForm = >(method: RequestMet /** * The Inertia form. */ - const inertiaForm = useInertiaForm(inputs) + const inertiaForm = useInertiaForm(inputs) as Omit>, never> + // typecast can be removed/reverted when inertiajs/inertia#1734 is merged and released, tricks TS to not care for now by making it a more complex type. /** * The Precognitive form.