fix: Typing of labelMap (#21181)

* fix: Typing of labelMap

* Adjusts val types
This commit is contained in:
Michael S. Molina
2022-08-26 08:22:57 -03:00
committed by GitHub
parent 5811262cf2
commit 1143e17742
11 changed files with 47 additions and 64 deletions

View File

@@ -18,7 +18,6 @@
*/
import {
CategoricalColorNamespace,
DataRecordValue,
DataRecord,
getMetricLabel,
getNumberFormatter,
@@ -121,20 +120,17 @@ export default function transformProps(
const keys = data.map(datum =>
extractGroupbyLabel({ datum, groupby: groupbyLabels, coltypeMapping: {} }),
);
const labelMap = data.reduce(
(acc: Record<string, DataRecordValue[]>, datum) => {
const label = extractGroupbyLabel({
datum,
groupby: groupbyLabels,
coltypeMapping: {},
});
return {
...acc,
[label]: groupbyLabels.map(col => datum[col]),
};
},
{},
);
const labelMap = data.reduce((acc: Record<string, string[]>, datum) => {
const label = extractGroupbyLabel({
datum,
groupby: groupbyLabels,
coltypeMapping: {},
});
return {
...acc,
[label]: groupbyLabels.map(col => datum[col] as string),
};
}, {});
const { setDataMask = () => {}, onContextMenu } = hooks;