Oops, fix type error.

pull/6/head
Atul Varma 2021-02-16 07:17:40 -05:00
rodzic aa87e3b77e
commit 9ac1243249
1 zmienionych plików z 5 dodań i 9 usunięć

Wyświetl plik

@ -106,11 +106,8 @@ function sortedPoints(points: PointWithNormal[]): PointWithNormal[] {
return copy;
}
function sortedPointConcat(
first: PointWithNormal[] | undefined,
second: PointWithNormal[]
): PointWithNormal[] {
return first ? sortedPoints([...first, ...second]) : sortedPoints(second);
function concat<T>(first: T[] | undefined, second: T[]): T[] {
return first ? [...first, ...second] : second;
}
const ATTACHMENT_COLOR_MAP = new Map(
@ -126,9 +123,8 @@ function updateSpecs(fill: string, path: string, specs: Specs): Specs {
if (attachmentType) {
return {
...specs,
[attachmentType]: sortedPointConcat(
specs[attachmentType],
getArrowPoints(path)
[attachmentType]: sortedPoints(
concat(specs[attachmentType], getArrowPoints(path))
),
};
}
@ -136,7 +132,7 @@ function updateSpecs(fill: string, path: string, specs: Specs): Specs {
if (fill === colors.NESTING_BOUNDING_BOX_COLOR) {
return {
...specs,
nesting: sortedPointConcat(specs.nesting, getBoundingBoxes(path)),
nesting: concat(specs.nesting, getBoundingBoxes(path)),
};
}