microsoft / microsoft/monaco-editor

[Bug] Cannot redeclare block-scoped variable 'Map'.

Open
#4,507 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
46.8k
Forks
4.1k
Avg merge
17h 58m
Merged PRs (30d)
1

Description

Reproducible in vscode.dev or in VS Code Desktop?
  • Not reproducible in vscode.dev or VS Code Desktop
Reproducible in the monaco editor playground?
Monaco Editor Playground Link

https://microsoft.github.io/monaco-editor/playground.html?source=v0.48.0#XQAAAAIeAwAAAAAAAABBqQkHQ5NjdMjwa-jY7SIQ9S7DNlzs5W-mwj0fe1ZCDRFc9ws9XQE0SJE1jc2VKxhaLFIw9vEWSxW3yscw27OaSAEiAKctgAboa7AaZZDHLgrLqPRv_fRv2RyIokydlTdTYccsu6v6jDrc8jQ8uomCtyomqm1LqDD_pl47XPueI4_xE1hM8C4okGKxS6m9zh5nNGhOylcnaTpmBCR8sQwOcZtcGoTeIPuqVabkHs8y-ooacdR_6YPNTeJwf0aa6YPfFclxPj9FYskflgdAetNI6oRuDo72fbJ7FvkFfx75MZ8VQ0xxQ3ypU19hXmZjJCpCR94FdDhfIpt9rpCAIQ2pGL9nd9z042ZtgS1GWVVwVlypkDr3T3gMf-eU_63vDjh7lZHRYFRjyQQctPnI9fd-n8kAswG57SPodOmzt8_6UiM4_GM-lN7Q-JoTpeNqGP_ynvFy3NZXScb-PaGCNQ6WpXu6kZeSyfeAJvvIwtU63B1A1o6JjUIBZdek0wFOniKdcfcLRV9_nS-dVUoWjwHx3de_Hg14KumvWmq3rVT-FYin60W0Gzl427mm0khENcHP9QRNpDm2n6r0OAtTs5mpdxhFF_GW7vxxP2H_NwspAA

Monaco Editor Playground Code
const value = /* set from `myEditor.getModel()`: */ `let Map = new Set();`;

// Hover on each property to see its docs!
const myEditor = monaco.editor.create(document.getElementById("container"), {
	value,
	language: "typescript",
	automaticLayout: true,
});
monaco.languages.typescript.typescriptDefaults.setCompilerOptions({
    target: monaco.languages.typescript.ScriptTarget.ES2019,
    module: monaco.languages.typescript.ModuleKind.ESNext,
    moduleResolution: monaco.languages.typescript.ModuleResolutionKind.NodeJs,
    strict: false,
    strictFunctionTypes: false,
    strictBindCallApply: false,
    noStrictGenericChecks: false,
    noImplicitAny: false,
    importHelpers: true,
    allowNonTsExtensions: true,
  });
Reproduction Steps

No response

Actual (Problematic) Behavior

Cannot redeclare block-scoped variable 'Map'.

Expected Behavior

No error

Additional Context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked Monaco Editor Playground reproduction and its embedded TypeScript code and compiler options. Trace where the redeclaration diagnostic for Map is produced, then verify the playground no longer reports the error with the shown configuration.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.