若是你想在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)