CodeMirror.Vim object not accessible

I want to map “jk” to escape insert mode. I’m not able to access the CodeMirror.Vim.map() function because I get this error:

“tsserver 2339] [E] Property ‘Vim’ does not exist on type ‘typeof CodeMirror’.”

I’m doing this in a React project.

import React from ‘react’;
import ReactDOM from ‘react-dom’;
import ‘./index.css’;
import App from ‘./App’;
import reportWebVitals from ‘./reportWebVitals’;
import ‘codemirror/lib/codemirror.css’;
import ‘codemirror/theme/the-matrix.css’;
import CodeMirror from ‘codemirror’;
// import {UnControlled as CodeMirror} from ‘@jkvim/react-codemirror2’
require(‘codemirror/mode/markdown/markdown.js’);
require(‘codemirror/mode/javascript/javascript’);
require(‘codemirror/keymap/vim.js’);

class VimMarkdown extends React.Component {

private codeInput = React.createRef();

constructor(props: Props){
super(props);
}

componentDidMount(){
if(this.codeInput.current){
CodeMirror.Vim.map(‘jk’, ‘’, ‘insert’) // Does not work!!
const CM = CodeMirror.fromTextArea(this.codeInput.current,{mode:‘markdown’, keyMap:‘vim’,theme:‘the-matrix’, lineNumbers:true})
}
}

render = () => {
return(




)
}
}

interface Props{
}

ReactDOM.render(
<React.StrictMode>

</React.StrictMode>,
document.getElementById(‘root’)
);
reportWebVitals();

Nvm I answered my own question. There are just no Typescript definitions for the Vim.js module included in the CodeMirror NPM package. You have to manually edit @types/codemirror/index.d.ts to include whatever Vim stuff you are using.