From 97b1a2f960079e0517c58b6645fdd443d2ebd707 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Wed, 24 Jun 2026 00:06:17 +0000 Subject: [PATCH] fix: narrow ParsedConfigValue to LocalEmulatorConfigValue with type guard Co-Authored-By: mantra --- apps/backend/src/lib/local-emulator.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/apps/backend/src/lib/local-emulator.ts b/apps/backend/src/lib/local-emulator.ts index ec144ab6f..452bc4fc5 100644 --- a/apps/backend/src/lib/local-emulator.ts +++ b/apps/backend/src/lib/local-emulator.ts @@ -76,7 +76,14 @@ async function readConfigContent(filePath: string): Promise { async function readConfigValueFromFile(filePath: string): Promise { const content = await readConfigContent(filePath); try { - return evalConfigFileContent(content, filePath); + const result = evalConfigFileContent(content, filePath); + if (typeof result === "string") { + if (result !== LOCAL_EMULATOR_SHOW_ONBOARDING_VALUE) { + throw new Error(`Unexpected string config value: ${JSON.stringify(result)}`); + } + return result; + } + return result; } catch (e) { const message = e instanceof Error ? e.message : String(e); throw new StatusError(StatusError.BadRequest, `Error evaluating config in ${filePath}: ${message}`);