diff --git a/packages/table/src/core/HeaderCell/HeaderCell.tsx b/packages/table/src/core/HeaderCell/HeaderCell.tsx index 65cdd5531..cb09e4eaf 100644 --- a/packages/table/src/core/HeaderCell/HeaderCell.tsx +++ b/packages/table/src/core/HeaderCell/HeaderCell.tsx @@ -13,7 +13,7 @@ interface HeaderCellProps { offsetX: number; children: React.ReactNode; resizable?: boolean; - onSort?: (colDef) => void; + onSort?: (colDef: ColDef) => void; } export const HeaderCell: React.FC = ({ @@ -33,7 +33,9 @@ export const HeaderCell: React.FC = ({ density={density} title={colDef.headerName} onClick={() => { - onSort(colDef); + if (onSort) { + onSort(colDef); + } }} > {children}