Skip to content

Commit 6f7114b

Browse files
committed
add typescript table row genericity
1 parent c3100c3 commit 6f7114b

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

typings/index.d.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,7 @@ declare namespace ElementReact {
603603
export class Slider extends ElementReactLibs.Component<SliderProps, {}> { }
604604

605605
// Table
606-
interface TableColumn {
606+
interface TableColumn<RowType> {
607607
label?: string
608608
prop?: string
609609
property?: string
@@ -619,11 +619,11 @@ declare namespace ElementReact {
619619
fixed?: boolean | string
620620
filterMethod?: () => void
621621
filters?: Object[]
622-
render?: (data? :Object, column? :Object, index? :number) => void
622+
render?: (data? :RowType, column? :Object, index? :number) => void
623623
}
624-
interface TableProps extends ElementReactLibs.ComponentProps<{}> {
625-
columns?: TableColumn[]
626-
data?: Object[]
624+
interface TableProps<RowType> extends ElementReactLibs.ComponentProps<{}> {
625+
columns?: TableColumn<RowType>[]
626+
data?: RowType[]
627627
height?: number
628628
stripe?: boolean
629629
border?: boolean
@@ -635,7 +635,7 @@ declare namespace ElementReact {
635635
onSelectAll?(): void
636636
onSelectChange?(): void
637637
}
638-
export class Table extends ElementReactLibs.Component<TableProps, {}> { }
638+
export class Table<RowType extends Object = any> extends ElementReactLibs.Component<TableProps<RowType>, {}> { }
639639

640640
// Switch
641641
interface SwitchProps extends ElementReactLibs.ComponentProps<{}> {

0 commit comments

Comments
 (0)