Skip to content

Commit

Permalink
fix: Update List ts definition (#16594)
Browse files Browse the repository at this point in the history
  • Loading branch information
zombieJ committed May 15, 2019
1 parent 5621b7b commit c598b36
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions components/list/index.tsx
Expand Up @@ -36,7 +36,7 @@ export interface ListProps<T> {
className?: string;
style?: React.CSSProperties;
children?: React.ReactNode;
dataSource: T[];
dataSource?: T[];
extra?: React.ReactNode;
grid?: ListGridType;
id?: string;
Expand All @@ -46,7 +46,7 @@ export interface ListProps<T> {
pagination?: PaginationConfig | false;
prefixCls?: string;
rowKey?: any;
renderItem: (item: T, index: number) => React.ReactNode;
renderItem?: (item: T, index: number) => React.ReactNode;
size?: ListSize;
split?: boolean;
header?: React.ReactNode;
Expand Down Expand Up @@ -124,6 +124,8 @@ export default class List<T> extends React.Component<ListProps<T>, ListState> {

renderItem = (item: any, index: number) => {
const { renderItem, rowKey } = this.props;
if (!renderItem) return null;

let key;

if (typeof rowKey === 'function') {
Expand Down Expand Up @@ -170,7 +172,7 @@ export default class List<T> extends React.Component<ListProps<T>, ListState> {
loadMore,
pagination,
grid,
dataSource,
dataSource = [],
size,
rowKey,
renderItem,
Expand Down

0 comments on commit c598b36

Please sign in to comment.