From bf10bb8e045aae0a6f6751d22f5f1a0774f2adb0 Mon Sep 17 00:00:00 2001 From: Joel Jeremy Marquez Date: Fri, 28 Feb 2025 08:37:37 -0800 Subject: [PATCH] Fix typecheck error --- .../src/components/mobile/accounts/Accounts.tsx | 4 ++-- packages/loot-core/src/client/accounts/accountsSlice.ts | 2 +- packages/loot-core/src/server/accounts/app.ts | 2 +- packages/loot-core/src/server/db/index.ts | 2 +- packages/loot-core/src/server/db/sort.ts | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/desktop-client/src/components/mobile/accounts/Accounts.tsx b/packages/desktop-client/src/components/mobile/accounts/Accounts.tsx index f3230bbb4b9..25778b0f958 100644 --- a/packages/desktop-client/src/components/mobile/accounts/Accounts.tsx +++ b/packages/desktop-client/src/components/mobile/accounts/Accounts.tsx @@ -366,9 +366,9 @@ function AccountList({ // Due to the way `moveAccount` works, we use the account next to the // actual target account here because `moveAccount` always shoves the // account *before* the target account. - // On the other hand, using `undefined` as `targetId`moves the account + // On the other hand, using `null` as `targetId`moves the account // to the end of the list. - targetId: nextToTargetAccount?.id || undefined, + targetId: nextToTargetAccount?.id || null, }), ); } diff --git a/packages/loot-core/src/client/accounts/accountsSlice.ts b/packages/loot-core/src/client/accounts/accountsSlice.ts index 0f032115b14..9cc37df4193 100644 --- a/packages/loot-core/src/client/accounts/accountsSlice.ts +++ b/packages/loot-core/src/client/accounts/accountsSlice.ts @@ -298,7 +298,7 @@ export const syncAccounts = createAppAsyncThunk( type MoveAccountPayload = { id: AccountEntity['id']; - targetId: AccountEntity['id']; + targetId: AccountEntity['id'] | null; }; export const moveAccount = createAppAsyncThunk( diff --git a/packages/loot-core/src/server/accounts/app.ts b/packages/loot-core/src/server/accounts/app.ts index d8ee393e7e5..f04e1362501 100644 --- a/packages/loot-core/src/server/accounts/app.ts +++ b/packages/loot-core/src/server/accounts/app.ts @@ -368,7 +368,7 @@ async function moveAccount({ targetId, }: { id: AccountEntity['id']; - targetId: AccountEntity['id']; + targetId: AccountEntity['id'] | null; }) { await db.moveAccount(id, targetId); } diff --git a/packages/loot-core/src/server/db/index.ts b/packages/loot-core/src/server/db/index.ts index 40927d042e7..a347119908b 100644 --- a/packages/loot-core/src/server/db/index.ts +++ b/packages/loot-core/src/server/db/index.ts @@ -693,7 +693,7 @@ export function deleteAccount(account) { export async function moveAccount( id: DbAccount['id'], - targetId: DbAccount['id'], + targetId: DbAccount['id'] | null, ) { const account = await first('SELECT * FROM accounts WHERE id = ?', [id]); let accounts; diff --git a/packages/loot-core/src/server/db/sort.ts b/packages/loot-core/src/server/db/sort.ts index eb59865317d..28fa615d52b 100644 --- a/packages/loot-core/src/server/db/sort.ts +++ b/packages/loot-core/src/server/db/sort.ts @@ -15,7 +15,7 @@ function midpoint(items: T[], to: number) { export function shoveSortOrders( items: T[], - targetId?: string, + targetId: string | null = null, ) { const to = items.findIndex(item => item.id === targetId); const target = items[to];