Skip to content

Commit c95b46c

Browse files
committed
fix(types): Resolve TypeScript compilation errors
- Fix Usage type conversion in anthropic adapter by adding unknown cast - Import SupportedLanguage type and use proper type assertions in config service - Fix theme type to match UIConfig interface constraints 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 0eda3a1 commit c95b46c

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/lib/adapters/anthropic-adapter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ export class AnthropicAdapter extends BaseLLMAdapter {
140140
const timeTaken = Date.now() - startTime;
141141

142142
// Log cache usage information if available
143-
const usage = completion.usage as Record<string, unknown>;
143+
const usage = completion.usage as unknown as Record<string, unknown>;
144144
const cacheCreationTokens = (usage?.cache_creation_input_tokens as number) || 0;
145145
const cacheReadTokens = (usage?.cache_read_input_tokens as number) || 0;
146146
let cacheInfo = '';

src/lib/services/config-service.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { AppConfig, DEFAULT_CONFIG, STORAGE_KEYS, DEFAULT_MODELS } from "../types/config";
2+
import { SupportedLanguage } from "../types/llm";
23

34
// Flag to indicate if we're in a server-side rendering environment
45
const isSSR = typeof window === 'undefined';
@@ -336,11 +337,11 @@ function convertFromSnakeCase(backendConfig: Record<string, unknown>): AppConfig
336337
modChunkSize: (translation?.mod_chunk_size as number) || 50,
337338
questChunkSize: (translation?.quest_chunk_size as number) || 1,
338339
guidebookChunkSize: (translation?.guidebook_chunk_size as number) || 1,
339-
additionalLanguages: (translation?.custom_languages as unknown[]) || [],
340+
additionalLanguages: (translation?.custom_languages as SupportedLanguage[]) || [],
340341
resourcePackName: (translation?.resource_pack_name as string) || "MinecraftModsLocalizer"
341342
},
342343
ui: {
343-
theme: (ui?.theme as string) || "system"
344+
theme: (ui?.theme as "light" | "dark" | "system") || "system"
344345
},
345346
paths: {
346347
minecraftDir: (paths?.minecraft_dir as string) || "",

0 commit comments

Comments
 (0)