diff --git a/packages/core/src/shared/externals.ts b/packages/core/src/shared/externals.ts index 047d53f91d6..5a5ceaea7c5 100644 --- a/packages/core/src/shared/externals.ts +++ b/packages/core/src/shared/externals.ts @@ -31,7 +31,7 @@ import { isVoidFieldState, } from './checkers' -const createForm = = any>( +const createForm = ( options?: IFormProps ) => { return new Form(options) diff --git a/packages/core/src/types.ts b/packages/core/src/types.ts index c99a75f9197..cc2f5a526a5 100644 --- a/packages/core/src/types.ts +++ b/packages/core/src/types.ts @@ -213,7 +213,7 @@ export type IFormState = any> = Partial< export type IFormGraph = Record -export interface IFormProps { +export interface IFormProps { values?: Partial initialValues?: Partial pattern?: FormPatternTypes @@ -224,7 +224,7 @@ export interface IFormProps { disabled?: boolean readOnly?: boolean readPretty?: boolean - effects?: (form: Form) => void + effects?: (form: Form) => void validateFirst?: boolean } diff --git a/packages/react/src/hooks/useForm.ts b/packages/react/src/hooks/useForm.ts index 34f383828ba..2395c3468fd 100644 --- a/packages/react/src/hooks/useForm.ts +++ b/packages/react/src/hooks/useForm.ts @@ -2,7 +2,7 @@ import { Form } from '@formily/core/esm/models' import { useContext } from 'react' import { FormContext } from '../shared' -export const useForm = >(): Form => { +export const useForm = (): Form => { const form = useContext(FormContext) if (!form) { throw new Error('Can not found form instance from context.')