better ts type

This commit is contained in:
陈帅 2019-03-28 18:55:52 +08:00
parent 0c1392ce4c
commit e9df687df5

View File

@ -31,11 +31,11 @@ export type ListSize = 'small' | 'default' | 'large';
export type ListItemLayout = 'horizontal' | 'vertical';
export interface ListProps {
export interface ListProps<T> {
bordered?: boolean;
className?: string;
children?: React.ReactNode;
dataSource: any;
dataSource: T[];
extra?: React.ReactNode;
grid?: ListGridType;
id?: string;
@ -57,7 +57,7 @@ export interface ListLocale {
emptyText: React.ReactNode | (() => React.ReactNode);
}
export default class List extends React.Component<ListProps> {
export default class List<T> extends React.Component<ListProps<T>> {
static Item: typeof Item = Item;
static childContextTypes = {
@ -70,7 +70,7 @@ export default class List extends React.Component<ListProps> {
bordered: false,
split: true,
loading: false,
pagination: false as ListProps['pagination'],
pagination: false as ListProps<any>['pagination'],
};
state = {