ElemeFE / element-react

Element UI
https://elemefe.github.io/element-react/index
MIT License
2.83k stars 444 forks source link

typescript Property 'onSubmit' does not exist on type Form #1037

Open flaforgue opened 4 years ago

flaforgue commented 4 years ago

Description

Using React With Typescript, the following :

<Form onSubmit={handleSubmit}>

Causes a type error :

Property 'onSubmit' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<Form> & Readonly<FormProps> & Readonly<{ children?: ReactNode; }>'

I think this might resolve the problem.

Reproduce Steps

<Form onSubmit={handleSubmit}>

Error Trace (if possible)

N/A

Solution

add onSubmit prop to FormProps interface : https://github.com/ElemeFE/element-react/pull/1036