Skip to content

Commit 71af097

Browse files
committed
Currently returns error for DataTableManager
Signed-off-by: Winner95 <Winner95@users.noreply.github.com>
1 parent 0b2c805 commit 71af097

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed

__tests__/handler.test.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,13 @@ describe('typescript-react-function-component-props-handler', () => {
5252
expect(doc.props).toBeUndefined();
5353
});
5454

55+
// Currently returns error for DataTableManager
56+
test('handles React.FC<Props> components - DataTableManager', () => {
57+
expect(() => parseFixture('DataTableManager.tsx')).toThrow(
58+
'did not recognize object of type "ChainExpression"'
59+
);
60+
});
61+
5562
// Line 31 in index.js without type - can't be tested directly because of early return
5663
test('handles components without type', () => {
5764
const doc = parseFixture('ComponentWithoutType.tsx');

fixtures/DataTableManager.tsx

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import React from 'react';
2+
3+
type DataTableColumn<Row> = {
4+
key: string;
5+
label: string;
6+
isSortable?: boolean;
7+
renderItem: (row: Row) => React.ReactNode;
8+
};
9+
10+
type DataTableProps<Row> = {
11+
rows: Row[];
12+
columns: Array<DataTableColumn<Row>>;
13+
itemRenderer?: (row: Row) => React.ReactNode;
14+
};
15+
16+
type LayoutSettings = {
17+
density: 'compact' | 'cozy' | 'comfortable';
18+
isCondensed?: boolean;
19+
};
20+
21+
type ColumnManager = {
22+
hiddenColumns: string[];
23+
primaryButton?: React.ReactElement;
24+
secondaryButton?: React.ReactElement;
25+
};
26+
27+
type DataTableManagerProps<Row> = {
28+
dataTableProps: DataTableProps<Row>;
29+
displaySettings?: LayoutSettings;
30+
columnManager?: ColumnManager;
31+
onSettingsChange?: (action: string, nextValue: object) => void;
32+
};
33+
34+
export const DataTableManager: React.FC<DataTableManagerProps<any>> = (props) => {
35+
return <>{props.displaySettings?.density}</>;
36+
};

0 commit comments

Comments
 (0)