Skip to content

Commit f26c105

Browse files
fix: Fix TypeScript type errors in LogViewer and TabManager
- Fix NodeJS.Timeout type by using ReturnType<typeof setTimeout> - Fix xterm theme selection property with type assertion - Fix potential undefined array access in TabManager - Add node types to tsconfig.app.json for type-check
1 parent a706b77 commit f26c105

File tree

4 files changed

+10
-6
lines changed

4 files changed

+10
-6
lines changed

frontend/src/components/LogViewer.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ let terminal: Terminal | null = null
4646
let fitAddon: FitAddon | null = null
4747
let searchAddon: SearchAddon | null = null
4848
let ws: WebSocket | null = null
49-
let reconnectTimer: NodeJS.Timeout | null = null
49+
let reconnectTimer: ReturnType<typeof setTimeout> | null = null
5050
const reconnectDelay = 3000 // 3秒后重连
5151
let isUserAtBottom = true // 用户是否在底部
5252
@@ -147,7 +147,6 @@ const initTerminal = async () => {
147147
background: '#1e1e1e',
148148
foreground: '#ffffff',
149149
cursor: '#aeafad',
150-
selection: '#3a3d41',
151150
black: '#000000',
152151
red: '#cd3131',
153152
green: '#0dbc79',
@@ -163,8 +162,9 @@ const initTerminal = async () => {
163162
brightBlue: '#3b8eea',
164163
brightMagenta: '#d670d6',
165164
brightCyan: '#29b8db',
166-
brightWhite: '#ffffff'
167-
},
165+
brightWhite: '#ffffff',
166+
selection: '#3a3d41'
167+
} as any,
168168
scrollback: 10000, // 最多保留10000行历史记录,超过会自动清理旧内容
169169
disableStdin: false // 启用stdin以监听键盘事件
170170
})

frontend/src/components/TabManager.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ const closeTab = (tabId: string) => {
299299
const actionListTab = tabs.value.find(tab => tab.type === 'action-list')
300300
if (actionListTab) {
301301
nextTabId = actionListTab.id
302-
} else if (tabs.value.length > 0) {
302+
} else if (tabs.value.length > 0 && tabs.value[0]) {
303303
// 如果定时计划也不存在(理论上不应该发生),则切换到第一个tab
304304
nextTabId = tabs.value[0].id
305305
}

frontend/tsconfig.app.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"paths": {
99
"@/*": ["./src/*"]
1010
},
11-
"moduleResolution":"Node"
11+
"moduleResolution":"Node",
12+
"types": ["node"]
1213
}
1314
}

frontend/tsconfig.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
"ESNext",
2020
"DOM"
2121
],
22+
"types": [
23+
"node"
24+
],
2225
"skipLibCheck": true,
2326
"noEmit": true
2427
},

0 commit comments

Comments
 (0)