diff --git a/src/api/providers/anthropic.ts b/src/api/providers/anthropic.ts index 5bfcf37757..f3c8a514d1 100644 --- a/src/api/providers/anthropic.ts +++ b/src/api/providers/anthropic.ts @@ -99,7 +99,7 @@ export class AnthropicHandler extends BaseProvider implements SingleCompletionHa : {} // Variable to hold the log handle - will be created after request body is built - let logHandle: ReturnType + let logHandle: ReturnType | undefined try { switch (modelId) { @@ -379,7 +379,7 @@ export class AnthropicHandler extends BaseProvider implements SingleCompletionHa }) } catch (error) { // logHandle may not be assigned if error occurs before request body is built - if (logHandle!) { + if (logHandle) { logHandle.error(error) } throw error