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
Chiming in to confirm that TypeScript enums are 99.9% of the time a bad choice. Union types are almost always better, because they don't need a runtime, hence an import.
I'm assuming this was already the case with Inertia.visit() (now router.visit()) prior to the 1.0 release. It probably didn't come up often as there are shorthand methods like post() that bypass the need to specify the method argument.
The adapters previously weren't written in TypeScript, so their type definitions weren't 100% compatible with the core package when converting them to TypeScript. In hindsight, it probably would have been better to change the core definition rather than the adapter definitions.
It's a bit late to remove the enum now, but I have created a #1392 that introduces a union type.
Version:
@inertiajs/vue3
version: 1.0.0typescript
version: 4.9.4Describe the problem:
If you use a
<Link
like so:It gives the following error:
Type '"post"' is not assignable to type 'Method | undefined'.
What does work, is using the Method enum like so:
So if the plain
method="post"
is no longer supported, it should be reflected in the docs.Steps to reproduce:
See the description.
The text was updated successfully, but these errors were encountered: