@@ -2,7 +2,7 @@ |
| 2 | 2 | |
| 3 | 3 | import React, { useState, useEffect, useRef } from 'react'; |
| 4 | 4 | import TreeVisualizer from './TreeVisualizer'; |
| 5 | | -import { gameApi, FileSystemTree, FHSDirectory, CommandReferenceResponse, MoleDirection } from '@/lib/api'; |
| 5 | +import { gameApi, FileSystemTree, FHSDirectory, CommandReferenceResponse, MoleDirection, TreeNode } from '@/lib/api'; |
| 6 | 6 | |
| 7 | 7 | interface CommandHistoryEntry { |
| 8 | 8 | command: string; |
@@ -114,7 +114,7 @@ const Game: React.FC = () => { |
| 114 | 114 | setTerminalMinimized(true); // Keep terminal minimized on new game |
| 115 | 115 | setHasPlayedIntro(false); // Reset intro for new game |
| 116 | 116 | setMoleKilled(false); // Reset mole killed state |
| 117 | | - } catch (error) { |
| 117 | + } catch { |
| 118 | 118 | setGameState({ |
| 119 | 119 | ...gameState, |
| 120 | 120 | loading: false, |
@@ -131,8 +131,8 @@ const Game: React.FC = () => { |
| 131 | 131 | const response = await gameApi.getHint(gameState.tree.id); |
| 132 | 132 | setHints(response.hints); |
| 133 | 133 | setShowHints(true); |
| 134 | | - } catch (error) { |
| 135 | | - console.error('Failed to get hints', error); |
| 134 | + } catch { |
| 135 | + console.error('Failed to get hints'); |
| 136 | 136 | } |
| 137 | 137 | }; |
| 138 | 138 | |
@@ -142,8 +142,8 @@ const Game: React.FC = () => { |
| 142 | 142 | const response = await gameApi.getFHSReference(); |
| 143 | 143 | setFhsDirs(response.directories); |
| 144 | 144 | setShowFHS(true); |
| 145 | | - } catch (error) { |
| 146 | | - console.error('Failed to get FHS reference', error); |
| 145 | + } catch { |
| 146 | + console.error('Failed to get FHS reference'); |
| 147 | 147 | } |
| 148 | 148 | }; |
| 149 | 149 | |
@@ -155,8 +155,8 @@ const Game: React.FC = () => { |
| 155 | 155 | setCommandRef(response); |
| 156 | 156 | } |
| 157 | 157 | setShowCommands(true); |
| 158 | | - } catch (error) { |
| 159 | | - console.error('Failed to get command reference', error); |
| 158 | + } catch { |
| 159 | + console.error('Failed to get command reference'); |
| 160 | 160 | } |
| 161 | 161 | }; |
| 162 | 162 | |
@@ -256,7 +256,7 @@ const Game: React.FC = () => { |
| 256 | 256 | } |
| 257 | 257 | |
| 258 | 258 | setCommand(''); |
| 259 | | - } catch (error) { |
| 259 | + } catch { |
| 260 | 260 | setCommandHistory(prev => [...prev, { |
| 261 | 261 | command: cmd, |
| 262 | 262 | output: 'Error: Failed to execute command. Check your connection.', |
@@ -268,14 +268,14 @@ const Game: React.FC = () => { |
| 268 | 268 | }; |
| 269 | 269 | |
| 270 | 270 | // Update tree data to show mole when found |
| 271 | | - const updateTreeDataToShowMole = (treeData: any, molePath: string): any => { |
| 271 | + const updateTreeDataToShowMole = (treeData: TreeNode, molePath: string): TreeNode => { |
| 272 | 272 | if (treeData.path === molePath) { |
| 273 | 273 | return { ...treeData, has_mole: true }; |
| 274 | 274 | } |
| 275 | 275 | if (treeData.children) { |
| 276 | 276 | return { |
| 277 | 277 | ...treeData, |
| 278 | | - children: treeData.children.map((child: any) => |
| 278 | + children: treeData.children.map((child) => |
| 279 | 279 | updateTreeDataToShowMole(child, molePath) |
| 280 | 280 | ), |
| 281 | 281 | }; |
@@ -284,11 +284,11 @@ const Game: React.FC = () => { |
| 284 | 284 | }; |
| 285 | 285 | |
| 286 | 286 | // Remove mole from tree data |
| 287 | | - const removeMoleFromTree = (treeData: any): any => { |
| 287 | + const removeMoleFromTree = (treeData: TreeNode): TreeNode => { |
| 288 | 288 | return { |
| 289 | 289 | ...treeData, |
| 290 | 290 | has_mole: false, |
| 291 | | - children: treeData.children ? treeData.children.map((child: any) => removeMoleFromTree(child)) : [] |
| 291 | + children: treeData.children ? treeData.children.map((child) => removeMoleFromTree(child)) : [] |
| 292 | 292 | }; |
| 293 | 293 | }; |
| 294 | 294 | |