Add typing to column render methods

The render method for columns in Antd Table take the three arguments
value, record, index. If dataIndex is set then value is the property
given by dataIndex in record, otherwise value and record is the same.
Unfortunately only record has the proper type while value is the type
any.  Change usage of `render: value =>` to `render: (_, value) =>` to
get proper typing for the render methods defined on columns.
This commit is contained in:
Hornwitser committed 2024-01-11 01:21:35 +01:00
1 parent e530bbc83a
commit 880216b775
9 files changed
+30 -30

No files matched your search

@@ -55,14 +55,14 @@ export default function InstanceList(props: InstanceListProps) {
{
title: "Assigned Host",
key: "assignedHost",
render: instance => hostName(instance.assignedHost),
render: (_, instance) => hostName(instance.assignedHost),
sorter: (a, b) => strcmp(hostName(a.assignedHost), hostName(b.assignedHost)),
responsive: ["sm"],
},
{
title: "Public address",
key: "publicAddress",
render: instance => {
render: (_, instance) => {
let publicAddress = instancePublicAddress(instance);
return publicAddress ? <>
{publicAddress}
@@ -83,7 +83,7 @@ export default function InstanceList(props: InstanceListProps) {
{
title: "Status",
key: "status",
render: instance => <InstanceStatusTag status={instance["status"]} />,
render: (_, instance) => <InstanceStatusTag status={instance["status"]} />,
sorter: (a, b) => strcmp(a["status"], b["status"]),
},
];
@@ -91,7 +91,7 @@ export default function InstanceList(props: InstanceListProps) {
if (account.hasAnyPermission("core.instance.start", "core.instance.stop")) {
columns.push({
key: "action",
render: instance => <StartStopInstanceButton
render: (_, instance) => <StartStopInstanceButton
buttonProps={{ size: "small" }}
instance={instance}
/>,