iDevelopThings/vue3-jetstream-inertia-typescript

Issue with this.$inertia.form not existing

PeteJStewart opened this issue ยท 19 comments

This seems to be an issue where the form method is not recognised, as the $inertia class is returning as type Router.

I'm not sure this is really an issue, as I think it might just be a compiler error.
I can see the inertia class is actually using form, so I suspect it does still work.

I presume this can be resolved shim, but not entirely sure how to write that.

ERROR in ./resources/ts/Pages/Profile/UpdatePasswordForm.vue.ts(24,34)
      TS2339: Property 'form' does not exist on type 'Router'.

Hmmm, this is a weird one, never ran into it myself

Are you able to publish your repo with this issue? Will happily work on a fix if I can re-produce it :)

This seems to be an issue where the form method is not recognised, as the $inertia class is returning as type Router.

I'm not sure this is really an issue, as I think it might just be a compiler error. I can see the inertia class is actually using form, so I suspect it does still work.

I presume this can be resolved shim, but not entirely sure how to write that.

ERROR in ./resources/ts/Pages/Profile/UpdatePasswordForm.vue.ts(24,34)
      TS2339: Property 'form' does not exist on type 'Router'.

When I was using 0.6.0 version of @inertiajs/inertia-vue3, I catch this error.

This seems to be an issue where the form method is not recognised, as the $inertia class is returning as type Router.
I'm not sure this is really an issue, as I think it might just be a compiler error. I can see the inertia class is actually using form, so I suspect it does still work.
I presume this can be resolved shim, but not entirely sure how to write that.

ERROR in ./resources/ts/Pages/Profile/UpdatePasswordForm.vue.ts(24,34)
      TS2339: Property 'form' does not exist on type 'Router'.

When I was using 0.6.0 version of @inertiajs/inertia-vue3, I catch this error.

Are you both using Laravel 9? ๐Ÿค” I haven't tested this with it yet

Any updates on this?

I need more information on it to fix it :| I haven't had chance to play with it... but i'll quickly spin up a new project and see if i get the same problem

To be clear: I didn't encounter this issue but I also didn't try this repo because of this.
Btw: Is there an automated process to use this repo?

I had a feeling that was the case ๐Ÿ˜… but i'll find out for you

Btw: Is there an automated process to use this repo?

There isn't sadly, i just realised my self it's a bit of a pain, I wouldn't be 100% comfortable with a tool overriding your files neither, best way is to just "Download Zip" and then drag-drop the files into your application

image

Thank you really much.
It's just so sad that there is no default process to use typescript.

Okay so i don't actually have any issues... but my ide does show there's an error in this component, it builds and works fine, i'll just try to figure it out though :D

image

and yeah I agree, it's a shame

So... it's an inertia types issue O.o

Oh no.
So what is the way forward now?

Just trying to figure a way to patch it without having to convert all forms to use vues composition api

Essentially inertia removed the type for "form" on the components "$inertia" mixin... I love inertia, but sometimes I feel like some questionable decisions are made ๐Ÿ˜ข

Just noticed this in the default jetstream project:

<script setup>
import { Head } from '@inertiajs/inertia-vue3';
import JetAuthenticationCardLogo from '@/Jetstream/AuthenticationCardLogo.vue';

defineProps({
    policy: String,
});
</script>

This looks a little bit like TypeScript to me. Am I wrong?

Yeah that's some new vue3 composition api configuration

Instead of exporting an object with the "setup" function, you can define this script with "setup" instead

But on that note... if they converted parts, i'll take a look, might save me some headaches ๐Ÿ˜‚

There is already a PR for it: inertiajs/inertia#1143

Well for the time-being i just quickly converted the affected pages to use composition api ๐Ÿ˜…

Pushing in a couple of minutes ๐Ÿ‘

Should be good to use now, I'll close this issue, if you have any issues, create a new issue ๐Ÿ˜€

Thank you so much.