Skip to content

Commit

Permalink
fix: replace ts-ignore by proper types
Browse files Browse the repository at this point in the history
  • Loading branch information
Loïc Mangeonjean committed Feb 5, 2024
1 parent 016f9ad commit ef097eb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 1 addition & 2 deletions src/tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()!

Expand Down
4 changes: 4 additions & 0 deletions src/types/monaco.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
}

0 comments on commit ef097eb

Please sign in to comment.