stackblitz / core

Online IDE powered by Visual Studio Code ⚡️
https://stackblitz.com
MIT License
10.24k stars 889 forks source link

Changing 'lib' compiler option doesn't make a sense for `Object.fromEntries` #2030

Closed Eugeno closed 8 months ago

Eugeno commented 2 years ago

Property 'fromEntries' does not exist on type 'ObjectConstructor'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2019' or later.

component:

obj = Object.fromEntries(this.arr.map((ar) => [ar.a, ar.b]));

tsconfig.json:

{
  "compilerOptions": {
    "module": "esnext",
    "target": "es2019",
    "lib": [
      "es2020",
      "dom"
    ]
  }
}
Pdzoc commented 2 years ago

I have the same problem - changing lib and target option doesn't solve it. In my local copy of project on VS Code change for es2019 solve the problem.

@Eugeno Did you find another way to handle it?

Eugeno commented 2 years ago

Nope, created an object without Object.fromEntries

johnrbaur commented 1 year ago

I'm having the same problem trying to use flatMap(). I can't use lodash as a workaround because of #2618.

github-actions[bot] commented 8 months ago

In order to investigate further we need a link to a StackBlitz project reproducing the issue. /n /n As this issue has been inactive for 1 day without a reproduction link, it will be closed to allow prioritization of other issues. /n /n If this needs additional investigation, please share a reproduction link by opening a new issue. Thanks for your diligence in helping us continuously improve the StackBlitz platform.