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,
getColumnLabel,
getMetricLabel,
getNumberFormatter,
@@ -156,21 +155,18 @@ export default function transformProps(
)
.flat(2);
const labelMap = data.reduce(
(acc: Record<string, DataRecordValue[]>, datum) => {
const label = extractGroupbyLabel({
datum,
groupby: groupbyLabels,
coltypeMapping,
timeFormatter: getTimeFormatter(dateFormat),
});
return {
...acc,
[label]: groupbyLabels.map(col => datum[col]),
};
},
{},
);
const labelMap = data.reduce((acc: Record<string, string[]>, datum) => {
const label = extractGroupbyLabel({
datum,
groupby: groupbyLabels,
coltypeMapping,
timeFormatter: getTimeFormatter(dateFormat),
});
return {
...acc,
[label]: groupbyLabels.map(col => datum[col] as string),
};
}, {});
const selectedValues = (filterState.selectedValues || []).reduce(
(acc: Record<string, number>, selectedValue: string) => {