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]); 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); const percent = ((d.count / xMax) * 100).toFixed(1);
return d.show return d.show
? ({ ? ({

View File

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

View File

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