Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maps are not properly displayed on typescript playground #38448

Open
corollari opened this issue May 10, 2020 · 2 comments
Open

Maps are not properly displayed on typescript playground #38448

corollari opened this issue May 10, 2020 · 2 comments
Labels
Bug A bug in TypeScript
Milestone

Comments

@corollari
Copy link

This issue isn't related to the typescript compiler but to the playground present on typescript.org, which, according to #2246 and #17677, implements an instance of monaco-editor. I've opened this issue in this repository instead of the monaco-editor one because it seems that the problem is caused by the extensions to monaco-editor that have been added to build the playground. Feel free to close this issue if I'm mistaken.

TypeScript Version: 3.8.3

Search Terms:
Map console.log playground

Expected behavior:
The standard representation of the Map object Map { 1 => 32 } is printed on the console.log call.

Actual behavior:
An empty object {} is printed on the console.log call.

Related Issues:
There's an stackoverflow question from 2017 which complains about the same behaviour on a repl.it environment

Code

let m = new Map<number,number>()
m.set(1,32)
console.log(m)
Output
"use strict";
let m = new Map();
m.set(1, 32);
console.log(m);
Compiler Options
{
  "compilerOptions": {
    "noImplicitAny": true,
    "strictNullChecks": true,
    "strictFunctionTypes": true,
    "strictPropertyInitialization": true,
    "strictBindCallApply": true,
    "noImplicitThis": true,
    "noImplicitReturns": true,
    "alwaysStrict": true,
    "esModuleInterop": true,
    "declaration": true,
    "experimentalDecorators": true,
    "emitDecoratorMetadata": true,
    "moduleResolution": 2,
    "target": "ES2017",
    "jsx": "React",
    "module": "ESNext"
  }
}

Playground Link: Provided

@j-oliveras
Copy link
Contributor

I see the expected behavior using Firefox.

@corollari
Copy link
Author

corollari commented May 10, 2020

I've just tested it on both Firefox 75.0 and Chromium 81.0.4044.122 and have been able to reproduce the issue on the two of them. It must be noted that I'm referring to the Logs pane that is on the right side of the playground:
Screenshot from 2020-05-10 18-03-152

@RyanCavanaugh RyanCavanaugh added the Bug A bug in TypeScript label May 11, 2020
@RyanCavanaugh RyanCavanaugh added this to the Backlog milestone May 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript
Projects
None yet
Development

No branches or pull requests

3 participants