Add es2019.array to TypeScript libs, so we can use .flatten and .flatMap

This commit is contained in:
Henrik Giesel 2021-01-08 12:23:21 +01:00
parent b76639c2e3
commit 38a5f64150
3 changed files with 3 additions and 5 deletions

View File

@ -197,7 +197,7 @@ export function renderCards(
x.range([bounds.marginLeft, bounds.width - bounds.marginRight]);
const tableData = (data as any).flatMap((d: SummedDatum, idx: number) => {
const tableData = data.flatMap((d: SummedDatum, idx: number) => {
const percent = ((d.count / xMax) * 100).toFixed(1);
return d.show
? ({

View File

@ -108,9 +108,7 @@ export function prepareIntervalData(
const bins = histogram()
.domain(scale.domain() as [number, number])
.thresholds((scale.ticks(desiredBars) as any).flatMap(adjustTicks))(
allIntervals
);
.thresholds(scale.ticks(desiredBars).flatMap(adjustTicks))(allIntervals);
// empty graph?
const totalInPeriod = sum(bins, (bin) => bin.length);

View File

@ -3,7 +3,7 @@
"compilerOptions": {
"target": "es6",
"module": "es6",
"lib": ["es2016", "dom"],
"lib": ["es2016", "es2019.array", "dom"],
"baseUrl": ".",
"paths": {
"anki/*": ["../bazel-bin/ts/lib/*"]