materiahq / ngx-monaco-editor

Monaco Editor Library for Angular v6 and above
MIT License
159 stars 35 forks source link

ERROR: 'MonacoEnvironment' was also declared here. #43

Closed lepantella closed 3 years ago

lepantella commented 3 years ago
Error: node_modules/monaco-editor/esm/vs/editor/editor.api.d.ts:12:9 - error TS2451: Cannot redeclare block-scoped variable 'MonacoEnvironment'.

12     let MonacoEnvironment: Environment | undefined;
           ~~~~~~~~~~~~~~~~~

  node_modules/@materia-ui/ngx-monaco-editor/lib/interfaces/monaco.d.ts:11:13
    11 declare let MonacoEnvironment: monaco.Environment | undefined;
                   ~~~~~~~~~~~~~~~~~
    'MonacoEnvironment' was also declared here.
node_modules/@materia-ui/ngx-monaco-editor/lib/interfaces/monaco.d.ts:11:13 - error TS2451: Cannot redeclare block-scoped variable 'MonacoEnvironment'.

11 declare let MonacoEnvironment: monaco.Environment | undefined;
               ~~~~~~~~~~~~~~~~~

  node_modules/monaco-editor/esm/vs/editor/editor.api.d.ts:12:9
    12     let MonacoEnvironment: Environment | undefined;
               ~~~~~~~~~~~~~~~~~
    'MonacoEnvironment' was also declared here.

I'm using versions:

"@materia-ui/ngx-monaco-editor": "^5.0.0-beta.0",
"monaco-editor": "^0.21.2"
jmarc-roy commented 3 years ago

Hello @lepantella, Thanks for your feedback! What version of angular are you using ?

lepantella commented 3 years ago

Angular 11

jmarc-roy commented 3 years ago

I just remade a test with a local install of monaco-editor, and don't face this issue. If you follow the readme it should not happened. The only way I found to reproduce this issue is to load monaco-editor through webpack with angular builders. The root cause of that, is because our library (v5) includes monaco-editor 0.21.2 types definitions.

lepantella commented 3 years ago

I think that's exactly what I'm doing, thanks!

parky128 commented 3 years ago

@lepantella - Hi, how did you get past this error you are facing? I am also encountering the same issue. Thanks

lepantella commented 3 years ago

Well I replaced ngx-monaco-editor completely with pure javascript monaco-editor. You can also try different versions of ngx-monaco-editor one of them will work.