Skip to content

A local-first personal finance app

Update findSortUp and findSortDown parameter to be more generic (#6861)

Joel Jeremy Marquez11d0b9d82467
diff --git a/packages/desktop-client/src/components/budget/util.ts b/packages/desktop-client/src/components/budget/util.ts
index def1bc08a4..7891e1595d 100644
--- a/packages/desktop-client/src/components/budget/util.ts
+++ b/packages/desktop-client/src/components/budget/util.ts
@@ -125,8 +125,8 @@ export function makeAmountFullStyle(
};
}
-export function findSortDown(
- arr: CategoryGroupEntity[],
+export function findSortDown<T extends { id: string }>(
+ arr: T[],
pos: DropPosition,
targetId: string,
) {
@@ -149,8 +149,8 @@ export function findSortDown(
}
}
-export function findSortUp(
- arr: CategoryGroupEntity[],
+export function findSortUp<T extends { id: string }>(
+ arr: T[],
pos: DropPosition,
targetId: string,
) {
diff --git a/upcoming-release-notes/6861.md b/upcoming-release-notes/6861.md
new file mode 100644
index 0000000000..bfbe421112
--- /dev/null
+++ b/upcoming-release-notes/6861.md
@@ -0,0 +1,6 @@
+---
+category: Maintenance
+authors: [joel-jeremy]
+---
+
+Generalize `findSortDown` and `findSortUp` functions to accept any type with `id: string`.