diff --git a/src/TreeDataGrid.tsx b/src/TreeDataGrid.tsx index 4b855b26c6..7aea6211aa 100644 --- a/src/TreeDataGrid.tsx +++ b/src/TreeDataGrid.tsx @@ -36,7 +36,7 @@ export interface TreeDataGridProps ) => Record[]>; expandedGroupIds: ReadonlySet; onExpandedGroupIdsChange: (expandedGroupIds: Set) => void; - generateGroupId: ((groupKey: string, parentId?: string) => string) | undefined; + generateGroupId?: (groupKey: string, parentId?: string) => string; } type GroupByDictionary = Record< diff --git a/test/TreeDataGrid.test.tsx b/test/TreeDataGrid.test.tsx index 5e7630e9fe..0f55399445 100644 --- a/test/TreeDataGrid.test.tsx +++ b/test/TreeDataGrid.test.tsx @@ -127,7 +127,7 @@ function TestGrid({ groupBy, generateGroupId }: TestGridProps) { onExpandedGroupIdsChange={setExpandedGroupIds} onRowsChange={setRows} onPaste={onPaste} - generateGroupId={generateGroupId} + {...(generateGroupId && { generateGroupId })} /> ); }