From 463d31f3a9ef8c5bf3d1db963516e65d3d7896b9 Mon Sep 17 00:00:00 2001 From: DJ Mountney Date: Sun, 31 Dec 2023 13:05:41 -0800 Subject: [PATCH] Remove undefined error from subscribe-needs-bootstrap type --- packages/loot-core/src/server/main.ts | 13 +++++-------- packages/loot-core/src/types/server-handlers.d.ts | 3 +-- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/packages/loot-core/src/server/main.ts b/packages/loot-core/src/server/main.ts index a0138c97729..286bf0dcb37 100644 --- a/packages/loot-core/src/server/main.ts +++ b/packages/loot-core/src/server/main.ts @@ -1670,14 +1670,11 @@ handlers['set-server-url'] = async function ({ url, validate = true }) { if (validate) { // Validate the server is running - const { error } = await runHandler( - handlers['subscribe-needs-bootstrap'], - { - url, - }, - ); - if (error) { - return { error }; + const result = await runHandler(handlers['subscribe-needs-bootstrap'], { + url, + }); + if ('error' in result) { + return { error: result.error }; } } } diff --git a/packages/loot-core/src/types/server-handlers.d.ts b/packages/loot-core/src/types/server-handlers.d.ts index cc8bddb17e8..c2825efc677 100644 --- a/packages/loot-core/src/types/server-handlers.d.ts +++ b/packages/loot-core/src/types/server-handlers.d.ts @@ -283,8 +283,7 @@ export interface ServerHandlers { 'subscribe-needs-bootstrap': ( args: { url } = {}, ) => Promise< - | { error: string } - | { bootstrapped: unknown; hasServer: boolean; error?: undefined } + { error: string } | { bootstrapped: unknown; hasServer: boolean } >; 'subscribe-bootstrap': (arg: { password }) => Promise<{ error?: string }>;