demo: improve types for form basic demo (#47722)

This commit is contained in:
Olivier Louvignes 2024-03-06 02:44:26 +01:00 committed by GitHub
parent fe837e964c
commit 44b55c6435
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,13 +1,5 @@
import React from 'react';
import { Button, Checkbox, Form, Input } from 'antd';
const onFinish = (values: any) => {
console.log('Success:', values);
};
const onFinishFailed = (errorInfo: any) => {
console.log('Failed:', errorInfo);
};
import { Button, Checkbox, Form, type FormProps, Input } from 'antd';
type FieldType = {
username?: string;
@ -15,6 +7,14 @@ type FieldType = {
remember?: string;
};
const onFinish: FormProps<FieldType>["onFinish"] = (values) => {
console.log('Success:', values);
};
const onFinishFailed: FormProps<FieldType>["onFinishFailed"] = (errorInfo) => {
console.log('Failed:', errorInfo);
};
const App: React.FC = () => (
<Form
name="basic"