Skip to content
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

wrong type for formState #3884

Open
its-dibo opened this issue Mar 22, 2024 · 0 comments
Open

wrong type for formState #3884

its-dibo opened this issue Mar 22, 2024 · 0 comments
Labels

Comments

@its-dibo
Copy link

FormlyFormOptions.formState is defined as any, means it can accept any arbitrary value.
also, the docs says

The formState property is passed to all fields and is a mechanism for communicating between fields (without having to mess with your model).
which also means it holds arbitrary value that doesn't mean anything to firmly

but when you pass formStatus.disabled=true it disables the form, which means it has been interpreted by Formly, which is not implied neither by the type definition nor the documentation.

export interface FormlyFormOptions {
    updateInitialValue?: (model?: any) => void;
    resetModel?: (model?: any) => void;
    formState?: any;
    fieldChanges?: Subject<FormlyValueChangeEvent>;
    showError?: (field: FieldType) => boolean;
    build?: (field?: FormlyFieldConfig) => FormlyFieldConfig;
    checkExpressions?: (field: FormlyFieldConfig) => void;
    detectChanges?: (field: FormlyFieldConfig) => void;
    parentForm?: FormGroupDirective | null;
}

it should be changed to

formStats: {
  disabled: boolean 
  // other props that are used by Formly
 [key:string]: any
}
@its-dibo its-dibo added the bug label Mar 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

1 participant