Skip to content

Commit

Permalink
test: minimize the impact of assertion to a single property, which is…
Browse files Browse the repository at this point in the history
… parent
  • Loading branch information
monfera committed Jan 13, 2021
1 parent 1fa0580 commit f9e51f9
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -134,15 +134,16 @@ export function groupByRollup(

function getRootArrayNode(): ArrayNode {
const children: HierarchyOfArrays = [];
const bootstrap = {
const bootstrap: Omit<ArrayNode, typeof PARENT_KEY> = {
[AGGREGATE_KEY]: NaN,
[DEPTH_KEY]: NaN,
[CHILDREN_KEY]: children,
[INPUT_KEY]: [] as number[],
[PATH_KEY]: [] as number[],
[SORT_INDEX_KEY]: 0,
[STATISTICS_KEY]: { globalAggregate: 0 },
};
Object.assign(bootstrap, { [PARENT_KEY]: bootstrap });
return bootstrap as ArrayNode;
return { ...bootstrap, [PARENT_KEY]: bootstrap } as ArrayNode; // TS doesn't yet handle bootstrapping but the `Omit` above retains guarantee for all props except `[PARENT_KEY`
}

/** @internal */
Expand Down

0 comments on commit f9e51f9

Please sign in to comment.