Skip to content

Commit

Permalink
add typescript table row genericity
Browse files Browse the repository at this point in the history
  • Loading branch information
johanninos committed Jul 27, 2020
1 parent c3100c3 commit 6f7114b
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions typings/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,7 @@ declare namespace ElementReact {
export class Slider extends ElementReactLibs.Component<SliderProps, {}> { }

// Table
interface TableColumn {
interface TableColumn<RowType> {
label?: string
prop?: string
property?: string
Expand All @@ -619,11 +619,11 @@ declare namespace ElementReact {
fixed?: boolean | string
filterMethod?: () => void
filters?: Object[]
render?: (data? :Object, column? :Object, index? :number) => void
render?: (data? :RowType, column? :Object, index? :number) => void
}
interface TableProps extends ElementReactLibs.ComponentProps<{}> {
columns?: TableColumn[]
data?: Object[]
interface TableProps<RowType> extends ElementReactLibs.ComponentProps<{}> {
columns?: TableColumn<RowType>[]
data?: RowType[]
height?: number
stripe?: boolean
border?: boolean
Expand All @@ -635,7 +635,7 @@ declare namespace ElementReact {
onSelectAll?(): void
onSelectChange?(): void
}
export class Table extends ElementReactLibs.Component<TableProps, {}> { }
export class Table<RowType extends Object = any> extends ElementReactLibs.Component<TableProps<RowType>, {}> { }

// Switch
interface SwitchProps extends ElementReactLibs.ComponentProps<{}> {
Expand Down

0 comments on commit 6f7114b

Please sign in to comment.