From ef097eb884cf314b19285f19639cc92bace1a778 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Mangeonjean?= Date: Mon, 5 Feb 2024 22:44:52 +0100 Subject: [PATCH] fix: replace ts-ignore by proper types --- src/tools.ts | 3 +-- src/types/monaco.d.ts | 4 ++++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/tools.ts b/src/tools.ts index 5104ca0..d09a401 100644 --- a/src/tools.ts +++ b/src/tools.ts @@ -156,8 +156,7 @@ export function lockCodeWithoutDecoration ( } export function hideCodeWithoutDecoration (editor: monaco.editor.IStandaloneCodeEditor, decorations: string[]): () => void { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - let otherHiddenAreas: monaco.IRange[] = (editor as any)._getViewModel()._lines.getHiddenAreas() + let otherHiddenAreas: monaco.IRange[] = editor._getViewModel()?.getHiddenAreas() ?? [] function getHiddenAreas () { const model = editor.getModel()! diff --git a/src/types/monaco.d.ts b/src/types/monaco.d.ts index 14364f3..2ca02f2 100644 --- a/src/types/monaco.d.ts +++ b/src/types/monaco.d.ts @@ -6,6 +6,10 @@ declare module 'monaco-editor' { // This method is internal and is supposed to be used by the folding feature // We still use it to hide parts of the code in the `hideCodeWithoutDecoration` function setHiddenAreas(ranges: IRange[]): void + + _getViewModel(): { + getHiddenAreas(): IRange[] + } | undefined } } }