-
Notifications
You must be signed in to change notification settings - Fork 472
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
typescript FormDataConvertible is not well typed #1193
Comments
It looks like we may have had similar issues at the same time. I came here today to create an issue about typescript errors when sending nested data using Inertia manual visits. Inertia.patch('/users/1', {
user: {
first_name: 'Alan'
}
})
/*
Type '{ first_name: string; }' is not assignable to type 'FormDataConvertible'.
Object literal may only specify known properties, and 'first_name' does not exist in type 'FormDataConvertible[] | Blob | File | Date'.
*/ With Rails strong parameters, it's basically a requirement to send nested form data, so that really does need to be an option. What I find interesting is that if I tell my editor to ignore the typescript error, nested data is sent to the backend correctly. So that means the method works as expected, it's just the types which are incorrect. |
yes this is typescript specific issue if you ignore it or don't use typescript at all everything just works this just needs correction in its typing |
My workaround to appease the compiler for now:
|
The type error issue still persists in router.post(
'/endpoint',
{
...formData,
},
); |
Versions:
@inertiajs/inertia
version: 0.11.0@inertiajs/inertia-vue3
version: 0.6.0Describe the problem:
while using typesript if I use
there is error thrown
as long as structure of data is simple 1 layer like this
it works however it doesn't allow having object as value of property
there is no practical reason why it should be like that it is just because FormDataConvertible doesn't allow it
Steps to reproduce:
use typescript and copy this code
The text was updated successfully, but these errors were encountered: