Stack Exchange
Ant design type script Input field validation not working
I tried to do react type script for  Ant design   input  field validation , its not working i got this error

Property 'name' is missing in type '{}' but required in type
  'Readonly'

This is my code 
import * as React from "react";
import {Button, Card, Col,  Form, Icon, Input, Row,} from "antd";
import moment from 'moment';
import "./style.css";



const {TextArea} = Input;
const {Option} = Select;

const InputGroup = Input.Group;





export namespace Bookform {
    export interface Props {
       name:string;

    }
}

export class Bookform extends React.Component<Bookform.Props, any,any> {



    formRef: any = React.createRef();

    componentDidMount() {
        this.formRef.current.setFieldsValue({
            username: 'Bamboo',
        });
    }
    render() {

        return (

            <div className="my-book">
                <Form onSubmit={this.onSaveBook} name="base"  ref={this.formRef}>

                    <Row gutter={[8, 8]}>
                        <Card size="small" >
                            <Col span={12}>

                                <Form.Item 
                                    name="username" rules={[{ required: true }]}>
                                  <Input placeholder="My book"/>

                            </Form.Item>
                            </Col>

                        </Card>
                    </Row>
         <div>
                        <Button type="primary" htmlType="submit" block><Icon type="save"/>Add book</Button>


                    </div>

                </Form>
            </div>


        );
    }
}


The problem is with the props definition.
Make sure there is always value for the name prop or make it optional like below.
export interface Props {
    name?: string;
}

