diff --git a/src/form/index.tsx b/src/form/index.tsx index a81a3dbd9..3e979040b 100644 --- a/src/form/index.tsx +++ b/src/form/index.tsx @@ -159,10 +159,10 @@ export default createComponent({ .then(() => { emit('submit', values); }) - .catch((errors) => { + .catch((errors: FieldValidateError[]) => { emit('failed', { values, errors }); - if (props.scrollToError) { + if (props.scrollToError && errors[0].name) { scrollToField(errors[0].name); } }); diff --git a/src/utils/base.ts b/src/utils/base.ts index 580045754..4e1c97aac 100644 --- a/src/utils/base.ts +++ b/src/utils/base.ts @@ -7,7 +7,8 @@ export const inBrowser = typeof window !== 'undefined'; // unknown type for Vue prop export const UnknownProp = (null as unknown) as PropType; -export type ComponentInstance = ComponentPublicInstance; +// eslint-disable-next-line +export type ComponentInstance = ComponentPublicInstance<{}, any>; export function isDef(val: T): val is NonNullable { return val !== undefined && val !== null;