uiwjs / react-monacoeditor

Monaco Editor component for React.
https://uiwjs.github.io/react-monacoeditor/
MIT License
296 stars 25 forks source link

error TS2451: Cannot redeclare block-scoped variable 'MonacoEnvironment'. #85

Closed jmc420 closed 3 years ago

jmc420 commented 3 years ago

Hello

I am getting this Typescript error when I import MonacoEditor from '@uiw/react-monacoeditor';

node_modules/@uiw/react-monacoeditor/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/monaco-editor/esm/vs/editor/editor.api.d.ts:12:9
    12     let MonacoEnvironment: Environment | undefined;
'MonacoEnvironment' was also declared here.

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/@uiw/react-monacoeditor/node_modules/monaco-editor/esm/vs/editor/editor.api.d.ts:12:9
    12     let MonacoEnvironment: Environment | undefined;
'MonacoEnvironment' was also declared here.

[18:22:40] Found 2 errors. Watching for file changes.

jaywcjlove commented 3 years ago

Don't know what the problem is without an example? @jmc420

jmc420 commented 3 years ago

it was because I had this import in the code:

import { editor } from 'monaco-editor';

jaywcjlove commented 3 years ago

:) I updated the monaco-editor version to ^0.26.0

...