From e157f90991ae4f53956905a27a4967ca8e1b37ab Mon Sep 17 00:00:00 2001 From: Aryan Singh Date: Sat, 6 Dec 2025 15:57:53 +0530 Subject: [PATCH] fix(tts): add audio property to GenerateResult type and improve type safety - Add audio?: TTSResult property to CLI GenerateResult type definition - Improve type safety in handleTTSOutput method by removing unsafe type casts - Remove unused TTSResult import to fix ESLint error - Fixes type mismatch where code accessed result.audio but type didn't include it - Related to TTS-024 feature implementation --- src/cli/factories/commandFactory.ts | 10 ++++++---- src/lib/types/cli.ts | 2 ++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/cli/factories/commandFactory.ts b/src/cli/factories/commandFactory.ts index 125ccf00b9..fe2e408743 100644 --- a/src/cli/factories/commandFactory.ts +++ b/src/cli/factories/commandFactory.ts @@ -15,7 +15,6 @@ import type { import type { TokenUsage, AnalyticsData, - TTSResult, } from "../../lib/types/index.js"; import { configManager } from "../commands/config.js"; import { handleError } from "../errorHandler.js"; @@ -467,9 +466,12 @@ export class CLICommandFactory { return; } - // Extract audio from result - const resultObj = result as Record; - const audio = resultObj?.audio as TTSResult | undefined; + // Extract audio from result with proper type checking + if (!result || typeof result !== "object") { + return; + } + const generateResult = result as GenerateResult; + const audio = generateResult.audio; if (!audio) { if (!options.quiet) { diff --git a/src/lib/types/cli.ts b/src/lib/types/cli.ts index 789c1fe58b..ecea7c4193 100644 --- a/src/lib/types/cli.ts +++ b/src/lib/types/cli.ts @@ -375,6 +375,8 @@ export type GenerateResult = CommandResult & { name: string; description: string; }>; + /** TTS audio result when TTS is enabled */ + audio?: import("./index.js").TTSResult; }; /**