Skip to content

Commit d32b68b

Browse files
committed
fix(findNodeById): use generics
1 parent ecff581 commit d32b68b

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

src/common/util/tree/findNodeById.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
import { TableNode } from '@table-library/react-table-library/types/table';
22

3-
export const findNodeById = (nodes: TableNode[], id: string): TableNode | null =>
4-
nodes.reduce((acc: TableNode | null, value: TableNode) => {
3+
export const findNodeById = <T extends TableNode>(nodes: T[], id: string): T | null =>
4+
nodes.reduce((acc: T | null, value: T): T | null => {
55
if (acc) return acc;
66

77
if (value.id === id) {
88
return value;
99
}
1010

1111
if (value.nodes) {
12-
return findNodeById(value.nodes, id);
12+
return findNodeById(value.nodes, id) as T;
1313
}
1414

1515
return acc;

src/select/useRowSelect.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ const getRowProps = (props: RowProps, features: Features): FeatureProps => {
4040
const theme = `
4141
&.row-select-selected,
4242
&.row-select-single-selected {
43-
color: ${COLORS.FONT_PRIMARY};
4443
font-weight: bold;
4544
4645
background-color: ${COLORS.ROW_SELECTED};

0 commit comments

Comments
 (0)