fix: 修复类型问题 & 增加类型导出 (#116)

This commit is contained in:
July 2025-04-02 14:42:48 +08:00 committed by GitHub
parent b58bb43bcf
commit 05b287f3f8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 7 additions and 5 deletions

View File

@ -11,7 +11,7 @@ import { FieldArrayModel } from './field-array-model';
// parentContainer?: interfaces.Container;
// }
type CreateFormOptions = FormOptions & {
export type CreateFormOptions<T = any> = FormOptions<T> & {
/**
* true createForm form control.init()
* form
@ -20,7 +20,9 @@ type CreateFormOptions = FormOptions & {
disableAutoInit?: boolean;
};
export function createForm<TValues>(options?: CreateFormOptions): CreateFormReturn<TValues> {
export function createForm<TValues>(
options?: CreateFormOptions<TValues>
): CreateFormReturn<TValues> {
const { disableAutoInit = false, ...formOptions } = options || {};
const formModel = new FormModel();

View File

@ -1,5 +1,5 @@
export { FormModel } from './form-model';
export { createForm } from './create-form';
export { createForm, type CreateFormOptions } from './create-form';
export { FieldModel } from './field-model';
export { FieldArrayModel } from './field-array-model';

View File

@ -16,10 +16,10 @@ export type {
Field as IField,
Form as IForm,
Errors,
Warnings
Warnings,
} from './types';
export { ValidateTrigger } from './types';
export { createForm } from './core/create-form';
export { createForm, type CreateFormOptions } from './core/create-form';
export { Glob } from './utils';
export * from './core';