You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use a List component in a react app, without renderItem prop
What is expected?
‘renderItem’ is required in the interface ListProps. As the react-virtualized example in the document of List component shown, 'renderItem' is not used and there should not be any type error.
What is actually happening?
Actually in TypeScript environment, the 'prop' renderItem is required and if I copy the example code to my project, it will raise an TypeScript error:
Property 'renderItem' is missing in type '{ children: Element; grid: { gutter: number; sm: 1; md: 2; lg: 3; xl: 4; xxl: 6; }; }' but required in type 'Pick<Readonly<PropsWithChildren<ListProps<{}>>>, "children" | "footer" | "header" | "className" | "id" | "grid" | "prefixCls" | "extra" | "itemLayout" | "loadMore" | "rowKey" | "renderItem" | "size" | "locale">'.ts(2741)
index.d.ts(36, 5): 'renderItem' is declared here.
Environment
Info
antd
3.16.3
React
16.8.4
System
macOS Mojave 10.14.4
Browser
Chrome 74.0.3729.131
Although I use antd@3.16.3, the definition of renderItem is still not optional in the latest version of code.
The text was updated successfully, but these errors were encountered:
Reproduction link
https://github.com/ant-design/ant-design/blob/master/components/list/index.tsx
Steps to reproduce
Use a List component in a react app, without renderItem prop
What is expected?
‘renderItem’ is required in the interface ListProps. As the react-virtualized example in the document of List component shown, 'renderItem' is not used and there should not be any type error.
What is actually happening?
Actually in TypeScript environment, the 'prop' renderItem is required and if I copy the example code to my project, it will raise an TypeScript error:
Although I use antd@3.16.3, the definition of renderItem is still not optional in the latest version of code.
The text was updated successfully, but these errors were encountered: