How to use integrate typescript? #320
Replies: 2 comments
-
I installed monaco editor as a dev dependency and tried to include |
Beta Was this translation helpful? Give feedback.
-
A little bit cleaner way to type the import MonacoEditor from "@monaco-editor/react"
import type { BeforeMount, OnMount } from "@monaco-editor/react"
// ...
export default function Editor(props: Props) {
const handleEditorWillMount: BeforeMount = (monaco) => { monaco.foo... }
const handleEditorDidMount: OnMount = (editor, monaco) => { editor.bar... }
return (
<MonacoEditor
beforeMount={handleEditorWillMount}
onMount={handleEditorDidMount}
/>
)
} Unfortunately, I personally still needed to use the |
Beta Was this translation helpful? Give feedback.
-
I took a look at the types file in
src
but I'm still not clear on how to integrate typescript with it.for eg. Here's my
onMount
function.My question is what should be the types of
editor
andmonaco
in the function arguments?Beta Was this translation helpful? Give feedback.
All reactions