react table typescript

Solutions on MaxInterview for react table typescript by the best coders in the world

showing results for - "react table typescript"
Pietro
30 May 2020
1import {
2  UseColumnOrderInstanceProps,
3  UseColumnOrderState,
4  UseExpandedHooks,
5  UseExpandedInstanceProps,
6  UseExpandedOptions,
7  UseExpandedRowProps,
8  UseExpandedState,
9  UseFiltersColumnOptions,
10  UseFiltersColumnProps,
11  UseFiltersInstanceProps,
12  UseFiltersOptions,
13  UseFiltersState,
14  UseGlobalFiltersColumnOptions,
15  UseGlobalFiltersInstanceProps,
16  UseGlobalFiltersOptions,
17  UseGlobalFiltersState,
18  UseGroupByCellProps,
19  UseGroupByColumnOptions,
20  UseGroupByColumnProps,
21  UseGroupByHooks,
22  UseGroupByInstanceProps,
23  UseGroupByOptions,
24  UseGroupByRowProps,
25  UseGroupByState,
26  UsePaginationInstanceProps,
27  UsePaginationOptions,
28  UsePaginationState,
29  UseResizeColumnsColumnOptions,
30  UseResizeColumnsColumnProps,
31  UseResizeColumnsOptions,
32  UseResizeColumnsState,
33  UseRowSelectHooks,
34  UseRowSelectInstanceProps,
35  UseRowSelectOptions,
36  UseRowSelectRowProps,
37  UseRowSelectState,
38  UseRowStateCellProps,
39  UseRowStateInstanceProps,
40  UseRowStateOptions,
41  UseRowStateRowProps,
42  UseRowStateState,
43  UseSortByColumnOptions,
44  UseSortByColumnProps,
45  UseSortByHooks,
46  UseSortByInstanceProps,
47  UseSortByOptions,
48  UseSortByState
49} from 'react-table'
50
51declare module 'react-table' {
52  // take this file as-is, or comment out the sections that don't apply to your plugin configuration
53
54  export interface TableOptions<D extends Record<string, unknown>>
55    extends UseExpandedOptions<D>,
56      UseFiltersOptions<D>,
57      UseGlobalFiltersOptions<D>,
58      UseGroupByOptions<D>,
59      UsePaginationOptions<D>,
60      UseResizeColumnsOptions<D>,
61      UseRowSelectOptions<D>,
62      UseRowStateOptions<D>,
63      UseSortByOptions<D>,
64      // note that having Record here allows you to add anything to the options, this matches the spirit of the
65      // underlying js library, but might be cleaner if it's replaced by a more specific type that matches your
66      // feature set, this is a safe default.
67      Record<string, any> {}
68
69  export interface Hooks<D extends Record<string, unknown> = Record<string, unknown>>
70    extends UseExpandedHooks<D>,
71      UseGroupByHooks<D>,
72      UseRowSelectHooks<D>,
73      UseSortByHooks<D> {}
74
75  export interface TableInstance<D extends Record<string, unknown> = Record<string, unknown>>
76    extends UseColumnOrderInstanceProps<D>,
77      UseExpandedInstanceProps<D>,
78      UseFiltersInstanceProps<D>,
79      UseGlobalFiltersInstanceProps<D>,
80      UseGroupByInstanceProps<D>,
81      UsePaginationInstanceProps<D>,
82      UseRowSelectInstanceProps<D>,
83      UseRowStateInstanceProps<D>,
84      UseSortByInstanceProps<D> {}
85
86  export interface TableState<D extends Record<string, unknown> = Record<string, unknown>>
87    extends UseColumnOrderState<D>,
88      UseExpandedState<D>,
89      UseFiltersState<D>,
90      UseGlobalFiltersState<D>,
91      UseGroupByState<D>,
92      UsePaginationState<D>,
93      UseResizeColumnsState<D>,
94      UseRowSelectState<D>,
95      UseRowStateState<D>,
96      UseSortByState<D> {}
97
98  export interface ColumnInterface<D extends Record<string, unknown> = Record<string, unknown>>
99    extends UseFiltersColumnOptions<D>,
100      UseGlobalFiltersColumnOptions<D>,
101      UseGroupByColumnOptions<D>,
102      UseResizeColumnsColumnOptions<D>,
103      UseSortByColumnOptions<D> {}
104
105  export interface ColumnInstance<D extends Record<string, unknown> = Record<string, unknown>>
106    extends UseFiltersColumnProps<D>,
107      UseGroupByColumnProps<D>,
108      UseResizeColumnsColumnProps<D>,
109      UseSortByColumnProps<D> {}
110
111  export interface Cell<D extends Record<string, unknown> = Record<string, unknown>, V = any>
112    extends UseGroupByCellProps<D>,
113      UseRowStateCellProps<D> {}
114
115  export interface Row<D extends Record<string, unknown> = Record<string, unknown>>
116    extends UseExpandedRowProps<D>,
117      UseGroupByRowProps<D>,
118      UseRowSelectRowProps<D>,
119      UseRowStateRowProps<D> {}
120}
121