microsoft / microsoft/monaco-editor
Monaco-editor-core cannot be compiled: Cannot redeclare block-scoped variable 'MonacoEnvironment'.
Open
Nobody has claimed this yet.
bug
editor-core
- Dominant language
- JavaScript
- Stars
- 46.8k
- Forks
- 4.1k
- Avg merge
- 17h 58m
- Merged PRs (30d)
- 1
Description
Does this issue occur when all extensions are disabled?: Yes/No
- VS Code Version: latest
- OS Version: any OS
Steps to Reproduce:
- Set up a project like https://github.com/microsoft/monaco-editor/tree/main/samples/browser-esm-webpack-typescript
- Perform type check by
tscor fork-ts-checker-webpack-plugin.
Expected behavior
Compile successfully
Actual behavior
Cannot compile due to the 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/monaco-editor/monaco.d.ts:11:13
11 declare let MonacoEnvironment: monaco.Environment | undefined;
~~~~~~~~~~~~~~~~~
'MonacoEnvironment' was also declared here.
node_modules/monaco-editor/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.
Found 2 errors.
The reason behind this is you are coping declaration file in monaco.d.ts to editor.api.d.ts in https://github.com/microsoft/vscode/blob/c248f9ec0cf272351175ccf934054b18ffbf18c6/build/gulpfile.editor.js#L303-L320
Please fix it so we can compile the apps that use monaco-editor-core
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.