Compilation error: Property 'htmlType' is missing in type
See original GitHub issue- I have searched the issues of this repository and believe that this is not a duplicate.
Version
3.8.0
Environment
Windows 7
Steps to reproduce
After migration to typescript 3.0.1
and antd 3.8.0
I cannot compile project
<Button id="goToTopButton" className="scroll-to-top-button" shape="circle"> <i className="material-icons">arrow_upward</i> </Button>
What is expected?
Compilation sucseed
What is actually happening?
I have compilation error:
TS2322: Type ‘{ children: Element; id: string; className: string; shape: “circle”; }’ is not assignable to type ‘(IntrinsicAttributes & IntrinsicClassAttributes<Button> & Pick<Readonly<{ children?: ReactNode; }> & Readonly<AnchorButtonProps> & Pick<InferProps<{ type: any; shape: any; size: any; htmlType: any; … 4 more …; block: any; }>, “htmlType”>, “color” | … 258 more … | “htmlType”> & Partial<…> & Partial<…>) | …’. Type ‘{ children: Element; id: string; className: string; shape: “circle”; }’ is not assignable to type ‘Pick<Readonly<{ children?: ReactNode; }> & Readonly<NativeButtonProps> & Pick<InferProps<{ type: any; shape: any; size: any; htmlType: any; onClick: any; loading: any; className: any; icon: any; block: any; }>, “htmlType”>, “color” | … 262 more … | “value”>’. Property ‘htmlType’ is missing in type ‘{ children: Element; id: string; className: string; shape: “circle”; }’.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:31 (8 by maintainers)
Top GitHub Comments
I can confirm this is fixed, using:
typescript
3.0.1
antd
3.8.1
@types/prop-types
15.5.5
I had to explicitly upgrade
@types/prop-types
because@types/react
requires@types/prop-types
without specifying the version ("dependencies": { "@types/prop-types": "*",
).For a workaround you can downgrade to these NPMs
@types/react@16.4.7
@types/react-dom@16.0.6
See #11697