Typescript type error when using Form.create({mapPropsToFields}).
See original GitHub issueVersion
3.2.0
Environment
Mac OSX Sierra (10.12.6), Firefox 58.0.2, react 16.2.0, antd 3.2.0
Reproduction link
https://github.com/kevinsperrine/ant-design-form-test
Steps to reproduce
Clone the repo and run yarn start
. Minimal repo created using:
create-react-app form-test --scripts-version=react-scripts-ts
yarn add antd
What is expected?
No type errors should occur
What is actually happening?
A Typescript type error that the ‘form’ prop is missing is thrown.
/Users/chuck/Projects/form-test/src/App.tsx
(66,28): Type '{ username: string; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<Component<Pick<CustomFormProps, "username"> & Cust...'.
Type '{ username: string; }' is not assignable to type 'Readonly<Pick<CustomFormProps, "username"> & CustomFormProps>'.
Property 'form' is missing in type '{ username: string; }'.
Issue Analytics
- State:
- Created 6 years ago
- Comments:9 (5 by maintainers)
Top Results From Across the Web
Typescript build fails when I am trying to create an antd ...
You have to specify types in TypeScript : import { Form } from 'antd'; import { FormComponentProps } from 'antd/lib/form'; ...
Read more >Form - Ant Design - GitHub Pages
A form consists of one or more form fields whose type includes input, textarea, checkbox, radio, select, tag, and more. A form field...
Read more >Form - Ant Design
A form consists of one or more form fields whose type includes input, textarea, checkbox, radio, select, tag, and more. A form field...
Read more >Form - Ant Design
A form consists of one or more form fields whose type includes input, textarea, checkbox, radio, select, tag, and more. A form field...
Read more >Deciphering TypeScript's React errors | by Fiona Hopkins
When TypeScript complains, its error messages are verbose, with a lot ... The fix: We need to change one or the other of...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
当 CustomForm 继承React.Component<any, {}> 时 问题依旧 , 如 https://github.com/Nokecy/ant-design-form-test
@yesmeck @benjycui
Use ‘FormComponentProps’ and ‘export default Form.create()(App);’ It work’s for me