From de6c3b1f0ffc4f0c642881ea57b71adef56412d5 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Sun, 19 Jul 2026 14:19:10 +0000 Subject: [PATCH] refactor: avoid any type for editor parameter in EditorArea Improves code health and type safety by typing the Monaco Editor instance using Parameters[0] from @monaco-editor/react instead of any. This also allows implicit type inference for the cursor event parameter e. Co-authored-by: beingniloy <235952944+beingniloy@users.noreply.github.com> --- src/components/EditorArea.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/EditorArea.tsx b/src/components/EditorArea.tsx index f1d8f58..5d036fe 100644 --- a/src/components/EditorArea.tsx +++ b/src/components/EditorArea.tsx @@ -21,7 +21,7 @@ export default React.memo(function EditorArea() { const [editorTheme, setEditorTheme] = useState('vs-light'); const [recentlyClosedTabs, setRecentlyClosedTabs] = useState([]); const { menu, menuRef, showMenu, hideMenu } = useContextMenu(); - const editorRef = useRef(null); + const editorRef = useRef[0] | null>(null); useEffect(() => { setEditorTheme(theme === 'light' ? 'light' : 'vs-dark'); @@ -43,9 +43,9 @@ export default React.memo(function EditorArea() { const activeItem = activeFile && activeFile !== 'welcome' ? findFileInTree(files, activeFile) : null; - const handleEditorDidMount: OnMount = useCallback((editor: any) => { + const handleEditorDidMount: OnMount = useCallback((editor: Parameters[0]) => { editorRef.current = editor; - editor.onDidChangeCursorPosition((e: any) => { + editor.onDidChangeCursorPosition((e) => { setCursorLine(e.position.lineNumber); setCursorCol(e.position.column); });