diff --git a/types/react-table/index.d.ts b/types/react-table/index.d.ts index 09499e1010..ac0fc16e6d 100644 --- a/types/react-table/index.d.ts +++ b/types/react-table/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for react-table 6.7 +// Type definitions for react-table 6.6 // Project: https://github.com/react-tools/react-table // Definitions by: Roy Xue , // Pavel Sakalo , @@ -13,21 +13,53 @@ export type ReactTableFunction = (value?: any) => void; export type AccessorFunction = (row: D) => any; export type Accessor = string | string[] | AccessorFunction; export type Aggregator = (values: any, rows: any) => any; -export type TableCellRenderer = ((cellInfo: CellInfo, column: any) => React.ReactNode) | React.ReactNode; -export type FilterRender = (params: { column: Column, filter: any, onChange: ReactTableFunction, key?: string }) => React.ReactElement; -export type PivotRenderer = ((cellInfo: CellInfo) => React.ReactNode) | (() => any) | string | React.ReactNode; +export type TableCellRenderer = + | ((cellInfo: CellInfo, column: any) => React.ReactNode) + | React.ReactNode; +export type FilterRender = ( + params: { column: Column; filter: any; onChange: ReactTableFunction; key?: string } +) => React.ReactElement; +export type PivotRenderer = + | ((cellInfo: CellInfo) => React.ReactNode) + | (() => any) + | string + | React.ReactNode; -export type ComponentPropsGetter0 = (finalState: any, rowInfo: undefined, column: undefined, instance?: any) => object | undefined; -export type ComponentPropsGetterR = (finalState: any, rowInfo?: RowInfo, column?: undefined, instance?: any) => object | undefined; -export type ComponentPropsGetterC = (finalState: any, rowInfo?: undefined, column?: Column, instance?: any) => object | undefined; -export type ComponentPropsGetterRC = (finalState: any, rowInfo?: RowInfo, column?: Column, instance?: any) => object | undefined; +export type ComponentPropsGetter0 = ( + finalState: any, + rowInfo: undefined, + column: undefined, + instance?: any +) => object | undefined; +export type ComponentPropsGetterR = ( + finalState: any, + rowInfo?: RowInfo, + column?: undefined, + instance?: any +) => object | undefined; +export type ComponentPropsGetterC = ( + finalState: any, + rowInfo?: undefined, + column?: Column, + instance?: any +) => object | undefined; +export type ComponentPropsGetterRC = ( + finalState: any, + rowInfo?: RowInfo, + column?: Column, + instance?: any +) => object | undefined; export type DefaultFilterFunction = (filter: Filter, row: any, column: any) => boolean; export type FilterFunction = (filter: Filter, rows: any[], column: any) => any[]; export type SubComponentFunction = (rowInfo: RowInfo) => React.ReactNode; export type PageChangeFunction = (page: number) => void; export type PageSizeChangeFunction = (newPageSize: number, newPage: number) => void; -export type SortedChangeFunction = (newSorted: SortingRule[], column: any, additive: boolean) => void; +export type SortedChangeFunction = ( + newSorted: SortingRule[], + column: any, + additive: boolean +) => void; export type FilteredChangeFunction = (newFiltering: Filter[], column: any, value: any) => void; export type ExpandedChangeFunction = (column: any, event: any, isTouch: boolean) => void; export type ResizedChangeFunction = (newResized: Resize[], event: any) => void; @@ -48,13 +80,13 @@ export interface SortingRule { desc: boolean; } -export interface TableProps extends - Partial, - Partial, - Partial, - Partial, - Partial, - Partial { +export interface TableProps + extends Partial, + Partial, + Partial, + Partial, + Partial, + Partial { /** Default: [] */ data: D[]; @@ -381,13 +413,12 @@ export interface TextProps { rowsText: string; } -export interface GlobalColumn extends - Column.Basics, - Column.CellProps, - Column.FilterProps, - Column.FooterProps, - Column.HeaderProps { -} +export interface GlobalColumn + extends Column.Basics, + Column.CellProps, + Column.FilterProps, + Column.FooterProps, + Column.HeaderProps {} export namespace Column { /** Basic column props */ @@ -556,12 +587,12 @@ export interface PivotDefaults { render: TableCellRenderer; } -export interface Column extends - Partial, - Partial, - Partial, - Partial, - Partial { +export interface Column + extends Partial, + Partial, + Partial, + Partial, + Partial { /** * Property name as string or Accessor * @example: 'myProperty' @@ -670,7 +701,7 @@ export interface RowInfo { original: any; } -export interface CellInfo extends RowInfo, Pick { +export interface CellInfo extends RowInfo, Pick { /* true if this row is expanded */ isExpanded: boolean; @@ -728,7 +759,7 @@ export interface FinalState extends TableProps { } export const ReactTableDefaults: TableProps; -export default class ReactTable extends React.Component>> { } +export default class ReactTable extends React.Component>> {} export interface Instance extends ReactTable { context: any;