laravel / precognition

Anticipate the outcome of a future HTTP request.
https://laravel.com/docs/precognition
MIT License
132 stars 32 forks source link

Provide support for interfaces for useForm function (Vue & Inertia) #63

Closed juanparati closed 8 months ago

juanparati commented 8 months ago

Currently "useForm" from InertiaJS library support to pass a interface as generic, however "useForm" from "laravel-precognition-vue-inertia" only allows to pass a type that extends Record<string, unknown>. The fact to useForm uses a different signature it will force to convert all the form interfaces into types.

Using the keyword "satisfies" will solve the problem, however the linter will not suggest the interface properties.

It can be a good idea to support interfaces so it can facilitate the migration for InertiaJS useForm to Laravel Precognition useForm.

driesvints commented 8 months ago

Hi there, if you could whip up a PR for us to look at, that'd be great! Thanks.