Skip to content

New <Form> component $form object type reflection bad in Intelij IDE #3098

Discussion options

You must be logged in to vote

OK! Here is my workaround:

  1. Create a folder called types (adjacent from your pages folder) and place a file named index.d.ts there:

  2. Place the following code inside that file:

import {type FormFieldState} from '@primevue/forms';

export { };

declare global {
    interface PrimevueFormState {
        [key: string]: FormFieldState;
    }
    interface FormFieldErrors {
        [key: string]: FormFieldErrorType[];
    }
    type FormFieldErrorType = {
        message?: String;
    }
}
  1. Typecast your <Form> component slots like this:
<Form v-slot="$form:PrimevueFormState" :initialValues :resolver @submit="onFormSubmit">

(Basically just add :PrimevueFormState to $form in the v-slot attr…

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
2 replies
@RickKukiela
Comment options

@RickKukiela
Comment options

Answer selected by RickKukiela
Comment options

You must be logged in to vote
1 reply
@RickKukiela
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants