Skip to content

导出 useForm 函数返回值的类型定义 #6600

@van-chin

Description

@van-chin
  • I have searched the issues of this repository and believe that this is not a duplicate.

What problem does this feature solve?

方便定义变量的类型

What does the proposed API look like?

useForm.d.ts 文件中

export interface useFormType {
modelRef: Props | Ref<Props>;
rulesRef: Props | Ref<Props>;
initialModel: Props;
validateInfos: validateInfos;
resetFields: (newValues?: Props) => void;
validate: <T = any>(names?: namesType, option?: validateOptions) => Promise<T>;
/** This is an internal usage. Do not use in your prod */
validateField: (name: string, value: any, rules: Record<string, unknown>[], option?: validateOptions) => Promise<RuleError[]>;
mergeValidateInfo: (items: ValidateInfo | ValidateInfo[]) => ValidateInfo;
clearValidate: (names?: namesType) => void;
}
declare function useForm(modelRef: Props | Ref<Props>, rulesRef?: Props | Ref<Props>, options?: {
immediate?: boolean;
deep?: boolean;
validateOnRuleChange?: boolean;
debounce?: DebounceSettings;
onValidate?: Callbacks['onValidate'];
}): useFormRetrun;

import type { useFormType } from "ant-design-vue";

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions