diff --git a/src/tui/components/custom-editor.ts b/src/tui/components/custom-editor.ts index e1a4a8d1c..ad631f0e6 100644 --- a/src/tui/components/custom-editor.ts +++ b/src/tui/components/custom-editor.ts @@ -13,10 +13,9 @@ export class CustomEditor extends Editor { onAltEnter?: () => void; constructor(tuiOrTheme: TUI | EditorTheme, themeMaybe?: EditorTheme) { - const useTui = typeof themeMaybe !== "undefined" && Editor.length >= 2; - const args = (useTui ? [tuiOrTheme, themeMaybe] : [tuiOrTheme]) as ConstructorParameters< - typeof Editor - >; + const useLegacyCtor = typeof themeMaybe !== "undefined" && Editor.length >= 2; + const args = (useLegacyCtor ? [tuiOrTheme, themeMaybe] : [themeMaybe ?? tuiOrTheme]) as + ConstructorParameters; super(...args); } handleInput(data: string): void { diff --git a/src/tui/tui.ts b/src/tui/tui.ts index a5e6e34d7..753f5511f 100644 --- a/src/tui/tui.ts +++ b/src/tui/tui.ts @@ -193,7 +193,7 @@ export async function runTui(opts: TuiOptions) { const statusContainer = new Container(); const footer = new Text("", 1, 0); const chatLog = new ChatLog(); - const editor = new CustomEditor(tui, editorTheme); + const editor = new CustomEditor(editorTheme); const root = new Container(); root.addChild(header); root.addChild(chatLog);