uiwjs / react-monacoeditor

Monaco Editor component for React.

Home Page:https://uiwjs.github.io/react-monacoeditor/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

jmc420 opened this issue · comments

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.

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

it was because I had this import in the code:

import { editor } from 'monaco-editor';

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

...