Skip to content

Commit

Permalink
chore: changes types to interface so they can be extended
Browse files Browse the repository at this point in the history
  • Loading branch information
tommy committed Jul 5, 2024
1 parent 8a02c5a commit ba3246a
Showing 1 changed file with 30 additions and 28 deletions.
58 changes: 30 additions & 28 deletions packages/material-react-table/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -406,19 +406,20 @@ export interface MRT_TableState<TData extends MRT_RowData> extends TableState {
showToolbarDropZone: boolean;
}

export type MRT_ColumnDef<TData extends MRT_RowData, TValue = unknown> = Omit<
ColumnDef<TData, TValue>,
| 'accessorKey'
| 'aggregatedCell'
| 'aggregationFn'
| 'cell'
| 'columns'
| 'filterFn'
| 'footer'
| 'header'
| 'id'
| 'sortingFn'
> & {
export interface MRT_ColumnDef<TData extends MRT_RowData, TValue = unknown>
extends Omit<
ColumnDef<TData, TValue>,
| 'accessorKey'
| 'aggregatedCell'
| 'aggregationFn'
| 'cell'
| 'columns'
| 'filterFn'
| 'footer'
| 'header'
| 'id'
| 'sortingFn'
> {
AggregatedCell?: (props: {
cell: MRT_Cell<TData, TValue>;
column: MRT_Column<TData, TValue>;
Expand Down Expand Up @@ -682,7 +683,7 @@ export type MRT_ColumnDef<TData extends MRT_RowData, TValue = unknown> = Omit<
}) => ReactNode[];
sortingFn?: MRT_SortingFn<TData>;
visibleInShowHideMenu?: boolean;
};
}

export type MRT_DisplayColumnDef<
TData extends MRT_RowData,
Expand Down Expand Up @@ -802,19 +803,20 @@ export type MRT_DisplayColumnIds =
* See the full props list on the official docs site:
* @link https://www.material-react-table.com/docs/api/props
*/
export type MRT_TableOptions<TData extends MRT_RowData> = Omit<
Partial<TableOptions<TData>>,
| 'columns'
| 'data'
| 'defaultColumn'
| 'enableRowSelection'
| 'expandRowsFn'
| 'getRowId'
| 'globalFilterFn'
| 'initialState'
| 'onStateChange'
| 'state'
> & {
export interface MRT_TableOptions<TData extends MRT_RowData>
extends Omit<
Partial<TableOptions<TData>>,
| 'columns'
| 'data'
| 'defaultColumn'
| 'enableRowSelection'
| 'expandRowsFn'
| 'getRowId'
| 'globalFilterFn'
| 'initialState'
| 'onStateChange'
| 'state'
> {
columnFilterDisplayMode?: 'custom' | 'popover' | 'subheader';
columnFilterModeOptions?: Array<
LiteralUnion<string & MRT_FilterOption>
Expand Down Expand Up @@ -1293,4 +1295,4 @@ export type MRT_TableOptions<TData extends MRT_RowData> = Omit<
* Manage state externally any way you want, then pass it back into MRT.
*/
state?: Partial<MRT_TableState<TData>>;
};
}

0 comments on commit ba3246a

Please sign in to comment.