Skip to content

Commit bf1a56c

Browse files
gdeloryheloiseluikennylam
authored
fix(typescript): fixing DataTable sortRow type (#18073)
#18063 Co-authored-by: Heloise Lui <71858203+heloiselui@users.noreply.github.com> Co-authored-by: kennylam <909118+kennylam@users.noreply.github.com>
1 parent 89f037d commit bf1a56c

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

.all-contributorsrc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1791,6 +1791,15 @@
17911791
"code"
17921792
]
17931793
},
1794+
{
1795+
"login": "gdelory",
1796+
"name": "Guillaume Delory",
1797+
"avatar_url": "https://avatars.githubusercontent.com/u/9974707?v=4",
1798+
"profile": "https://github.com/gdelory",
1799+
"contributions": [
1800+
"code"
1801+
]
1802+
},
17941803
{
17951804
"login": "Bhas-kar",
17961805
"name": "Kanchi Bhaskar",

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,7 @@ check out our [Contributing Guide](/.github/CONTRIBUTING.md) and our
328328
<td align="center"><a href="https://github.com/heloiselui"><img src="https://avatars.githubusercontent.com/u/71858203?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Heloise Lui</b></sub></a><br /><a href="https://github.com/carbon-design-system/carbon/commits?author=heloiselui" title="Code">💻</a> <a href="https://github.com/carbon-design-system/carbon/commits?author=heloiselui" title="Documentation">📖</a> <a href="#a11y-heloiselui" title="Accessibility">️️️️♿️</a> <a href="https://github.com/carbon-design-system/carbon/pulls?q=is%3Apr+reviewed-by%3Aheloiselui" title="Reviewed Pull Requests">👀</a></td>
329329
<td align="center"><a href="https://github.com/Tweakified"><img src="https://avatars.githubusercontent.com/u/58192912?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Daniel Smith</b></sub></a><br /><a href="https://github.com/carbon-design-system/carbon/commits?author=Tweakified" title="Code">💻</a> <a href="#a11y-Tweakified" title="Accessibility">️️️️♿️</a> <a href="https://github.com/carbon-design-system/carbon/commits?author=Tweakified" title="Documentation">📖</a></td>
330330
<td align="center"><a href="https://github.com/enricobguedes"><img src="https://avatars.githubusercontent.com/u/45374536?v=4?s=100" width="100px;" alt=""/><br /><sub><b>enricobguedes</b></sub></a><br /><a href="https://github.com/carbon-design-system/carbon/commits?author=enricobguedes" title="Code">💻</a></td>
331+
<td align="center"><a href="https://github.com/gdelory"><img src="https://avatars.githubusercontent.com/u/9974707?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Guillaume Delory</b></sub></a><br /><a href="https://github.com/carbon-design-system/carbon/commits?author=gdelory" title="Code">💻</a></td>
331332
<td align="center"><a href="https://github.com/Bhas-kar"><img src="https://avatars.githubusercontent.com/u/183294521?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Kanchi Bhaskar</b></sub></a><br /><a href="https://github.com/carbon-design-system/carbon/commits?author=Bhas-kar" title="Code">💻</a> <a href="https://github.com/carbon-design-system/carbon/commits?author=Bhas-kar" title="Documentation">📖</a></td>
332333
</tr>
333334
</table>

packages/react/src/components/DataTable/DataTable.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,12 +245,18 @@ export interface DataTableProps<RowType, ColTypes extends any[]>
245245
rows: Array<Omit<DataTableRow<ColTypes>, 'cells'>>;
246246
size?: DataTableSize;
247247
sortRow?: (
248-
cellA: DataTableCell<any>,
249-
cellB: DataTableCell<any>,
248+
cellA: any,
249+
cellB: any,
250250
sortRowOptions: {
251251
sortDirection: DataTableSortState;
252252
sortStates: Record<DataTableSortState, DataTableSortState>;
253253
locale: string;
254+
key: string;
255+
compare: (
256+
a: number | string,
257+
b: number | string,
258+
locale?: string
259+
) => number;
254260
}
255261
) => number;
256262
stickyHeader?: boolean;

0 commit comments

Comments
 (0)