We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
T
keyof T
@inertiajs/vue3
When I try to access my form on a generic model T with a key: keyof T, Typescript raised an issue.
key: keyof T
<template> <div> <!-- Working --> <div>{{ form[key] }}</div> <!-- Working --> <div>{{ model[genericKey] }}</div> <!-- Type 'keyof T' cannot be used to index type 'DistributeRef<InertiaForm<T>> --> <div>{{ genericForm[genericKey] }}</div> </div> </template> <script setup lang="ts" generic="T extends object"> import { InertiaForm, useForm } from '@inertiajs/vue3'; const props = defineProps<{ model: T; genericKey: keyof T; }>(); // Test with non generic default values const defaultValues = { name: 'Thibaud' }; const form = useForm(defaultValues); const key = 'name' as keyof typeof defaultValues; const genericForm: InertiaForm<T> = useForm(props.model); </script>
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Version:
@inertiajs/vue3
version: 1.2.0Describe the problem:
When I try to access my form on a generic model
T
with akey: keyof T
, Typescript raised an issue.Steps to reproduce:
The text was updated successfully, but these errors were encountered: