ngx-monaco-editor
ngx-monaco-editor copied to clipboard
Typing Of Monaco On Version 12
Hi, I work with ngx-monaco-editor version 12 and with angular 12. I am trying to implement my one language with this component, after I finish the flow for connect the component to my project as was explain on https://www.npmjs.com/package/ngx-monaco-editor.
First when I tried to influence on the monaco by:
monaco.languages.register({ id: 'test', });
I got error that says "Cannot find name 'monaco'", for solve this I added
declare let monaco: any;
And it start to work, but I saw on some example that works on 9 version that not need to do this declare.
So I walked to the project's node modules and found there a monaco.d.ts folder with monaco name space with all the needed classes and interfaces, and on version 12 this folder not exists.
This typing is very helpful for understand the component.
What wrong did I do?
Having the same issue as well.
Yah, there was monaco.d.ts
before. Where did you lose it?
It's located inside monaco-editor
But how to import it from there?
As workaround I installed latest version of ngx-monaco-editor, which had monaco.d.ts
: 9.0.0
But don't import monaco build from there, it's outdated. Import it directly from monaco-editor
:
{
"glob": "**/*",
"input": "node_modules/monaco-editor/min",
"output": "./assets/monaco/"
}
Alternative way is to just add import to every file:
import * as monaco from 'monaco-editor'