From 149c3b5ce4a5cf20541919992937635b3b43633e Mon Sep 17 00:00:00 2001 From: Bentlybro Date: Fri, 13 Feb 2026 09:15:35 +0000 Subject: [PATCH] fix: add explicit types to avoid implicit any errors --- .../frontend/src/lib/streamdown-code-singleton.ts | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/autogpt_platform/frontend/src/lib/streamdown-code-singleton.ts b/autogpt_platform/frontend/src/lib/streamdown-code-singleton.ts index 14c4fa417d..44cb637467 100644 --- a/autogpt_platform/frontend/src/lib/streamdown-code-singleton.ts +++ b/autogpt_platform/frontend/src/lib/streamdown-code-singleton.ts @@ -80,7 +80,7 @@ async function getHighlighter(themes: [string, string]): Promise { themes: themes as [BundledTheme, BundledTheme], // Start with common languages pre-loaded for faster first render langs: ["javascript", "typescript", "python", "json", "html", "css", "bash", "markdown"], - }).then((h) => { + }).then((h: Highlighter) => { highlighterInstance = h; ["javascript", "typescript", "python", "json", "html", "css", "bash", "markdown"].forEach( (l) => loadedLanguages.add(l) @@ -111,7 +111,7 @@ async function ensureLanguageLoaded( loadedLanguages.add(language); pendingLanguages.delete(language); }) - .catch((err) => { + .catch((err: Error) => { console.warn(`[streamdown-code-singleton] Failed to load language: ${language}`, err); pendingLanguages.delete(language); }); @@ -120,13 +120,20 @@ async function ensureLanguageLoaded( return loadPromise; } +// Shiki token types +interface ShikiToken { + content: string; + color?: string; + htmlStyle?: Record; +} + // Convert shiki tokens to streamdown format function convertTokens( shikiResult: ReturnType ): HighlightResult { return { - tokens: shikiResult.tokens.map((line) => - line.map((token) => ({ + tokens: shikiResult.tokens.map((line: ShikiToken[]) => + line.map((token: ShikiToken) => ({ content: token.content, color: token.color, htmlStyle: token.htmlStyle,