vazco / uniforms

A React library for building forms from any schema.

Home Page:https://uniforms.tools

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add support for the props that the native <form /> takes

ErnestTeluk opened this issue · comments

Currently, <BaseForm /> does not support the types that the native form can accept e.g. name. If we add name prop to <ValidateForm /> we get this error:

TS2769: No overload matches this call.   Overload 1 of 2, '(props: ValidatedFormProps<unknown>): Validated<typeof BaseForm>.ValidatedForm<unknown, ValidatedFormProps<unknown>, ValidatedFormState<unknown>>', gave the following error.     Type '{ children: Element; schema: SimpleSchema2Bridge; model: { a: number; }; onValidate: Mock<any, [model: any, error: any]>; validator: Mock<any, any>; name: string; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<Validated<typeof BaseForm>.ValidatedForm<unknown, ValidatedFormProps<unknown>, ValidatedFormState<unknown>>> & Pick<...> & Partial<...> & Partial<...>'.       Property 'name' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<Validated<typeof BaseForm>.ValidatedForm<unknown, ValidatedFormProps<unknown>, ValidatedFormState<unknown>>> & Pick<...> & Partial<...> & Partial<...>'.   Overload 2 of 2, '(props: BaseFormProps<unknown>): BaseForm<unknown, BaseFormProps<unknown>, BaseFormState<unknown>>', gave the following error.     Type '{ children: Element; schema: SimpleSchema2Bridge; model: { a: number; }; onValidate: Mock<any, [model: any, error: any]>; validator: Mock<any, any>; name: string; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<BaseForm<unknown, BaseFormProps<unknown>, BaseFormState<unknown>>> & Pick<...> & Partial<...> & Partial<...>'.       Property 'validator' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<BaseForm<unknown, BaseFormProps<unknown>, BaseFormState<unknown>>> & Pick<...> & Partial<...> & Partial<...>'. Did you mean 'validate'?

As discussed, this should be a part of the requirements for #1160 instead.