Skip to content

Commit

Permalink
Fix typecheck error
Browse files Browse the repository at this point in the history
  • Loading branch information
joel-jeremy committed Feb 28, 2025
1 parent 40ae3a6 commit bf10bb8
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}),
);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/loot-core/src/client/accounts/accountsSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ export const syncAccounts = createAppAsyncThunk(

type MoveAccountPayload = {
id: AccountEntity['id'];
targetId: AccountEntity['id'];
targetId: AccountEntity['id'] | null;
};

export const moveAccount = createAppAsyncThunk(
Expand Down
2 changes: 1 addition & 1 deletion packages/loot-core/src/server/accounts/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ async function moveAccount({
targetId,
}: {
id: AccountEntity['id'];
targetId: AccountEntity['id'];
targetId: AccountEntity['id'] | null;
}) {
await db.moveAccount(id, targetId);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/loot-core/src/server/db/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion packages/loot-core/src/server/db/sort.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function midpoint<T extends { sort_order: number }>(items: T[], to: number) {

export function shoveSortOrders<T extends { id: string; sort_order: number }>(
items: T[],
targetId?: string,
targetId: string | null = null,
) {
const to = items.findIndex(item => item.id === targetId);
const target = items[to];
Expand Down

0 comments on commit bf10bb8

Please sign in to comment.