Fix undefined parsing error on languages missing from call routers (#364)

* fix: mapping all supported languages to callRouters to fix undefined apply error (#352)

* fix(cli): remove duplicate Swift/Kotlin keys in callRouters causing TS1117

* refactor: remove runtime callRouter fallbacks, rely on Record<SupportedLanguages> compile-time enforcement

* refactor: use 'satisfies' keyword for callRouters compile-time enforcement
This commit is contained in:
Berk Demirci 2026-03-18 17:52:54 +03:00 • committed by GitHub
parent ef319975de
commit a3536cd934
3 changed files with 6 additions and 4 deletions

View file

@ -10,5 +10,6 @@ export enum SupportedLanguages {
Rust = 'rust',
PHP = 'php',
Ruby = 'ruby',
Kotlin = 'kotlin',
Swift = 'swift',
}

View file

@ -27,7 +27,7 @@ export type CallRouter = (
const noRouting: CallRouter = () => null;
/** Per-language call routing. noRouting = no special routing (normal call processing) */
export const callRouters: Record<SupportedLanguages, CallRouter> = {
export const callRouters = {
[SupportedLanguages.JavaScript]: noRouting,
[SupportedLanguages.TypeScript]: noRouting,
[SupportedLanguages.Python]: noRouting,
@ -40,7 +40,8 @@ export const callRouters: Record<SupportedLanguages, CallRouter> = {
[SupportedLanguages.CPlusPlus]: noRouting,
[SupportedLanguages.C]: noRouting,
[SupportedLanguages.Ruby]: routeRubyCall,
};
[SupportedLanguages.Kotlin]: noRouting,
} satisfies Record<SupportedLanguages, CallRouter>;
// ── Result types ────────────────────────────────────────────────────────────

View file

@ -27,7 +27,7 @@ export type CallRouter = (
const noRouting: CallRouter = () => null;
/** Per-language call routing. noRouting = no special routing (normal call processing) */
export const callRouters: Record<SupportedLanguages, CallRouter> = {
export const callRouters = {
[SupportedLanguages.JavaScript]: noRouting,
[SupportedLanguages.TypeScript]: noRouting,
[SupportedLanguages.Python]: noRouting,
@ -41,7 +41,7 @@ export const callRouters: Record<SupportedLanguages, CallRouter> = {
[SupportedLanguages.CPlusPlus]: noRouting,
[SupportedLanguages.C]: noRouting,
[SupportedLanguages.Ruby]: routeRubyCall,
};
} satisfies Record<SupportedLanguages, CallRouter>;
// ── Result types ────────────────────────────────────────────────────────────