Skip to content

Commit ef097eb

Browse files
author
Loïc Mangeonjean
committed
fix: replace ts-ignore by proper types
1 parent 016f9ad commit ef097eb

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/tools.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,7 @@ export function lockCodeWithoutDecoration (
156156
}
157157

158158
export function hideCodeWithoutDecoration (editor: monaco.editor.IStandaloneCodeEditor, decorations: string[]): () => void {
159-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
160-
let otherHiddenAreas: monaco.IRange[] = (editor as any)._getViewModel()._lines.getHiddenAreas()
159+
let otherHiddenAreas: monaco.IRange[] = editor._getViewModel()?.getHiddenAreas() ?? []
161160
function getHiddenAreas () {
162161
const model = editor.getModel()!
163162

src/types/monaco.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ declare module 'monaco-editor' {
66
// This method is internal and is supposed to be used by the folding feature
77
// We still use it to hide parts of the code in the `hideCodeWithoutDecoration` function
88
setHiddenAreas(ranges: IRange[]): void
9+
10+
_getViewModel(): {
11+
getHiddenAreas(): IRange[]
12+
} | undefined
913
}
1014
}
1115
}

0 commit comments

Comments
 (0)