react tsx组件中使用 antd From 表单,父组件传值到子组件类型定义报错
解决方案:
引入antd Form类型声明 ,继承 antd类型声明的接口
import {
FormComponentProps } from 'antd/lib/form';
interface MyProps extends FormComponentProps {
text?: string;
}
const Son = (props: MyProps): JSX.Element => {
return <Form>...</Form>
const SonForm = Form.create<MyProps>({
name: 'son_form' })(Son);
export default SonForm;