若是你想在TypeScript中使用antd的from表单,在使用Form.create()方法时编辑器会报各类各样的错误,这是由于你没有规定form表单的interface。react
代码以下antd
import React, { PureComponent } from 'react' import { Form } from 'antd' import { FormComponentProps } from 'antd/lib/form/Form' //获取form表单的interface interface IProps { //定义所需的相应接口 onSave : any, onEdit : any, handlevisible : any } class FromModal extends PureComponent<IProps & FormComponentProps> { constructor(props: IProps & FormComponentProps) { super(props); } render () { return ( <Form layout="vertical"></Form> ) } } export default Form.create<IProps & FormComponentProps>()(FromModal)