StackBlitz - Property entries does not exist on type 'ObjectConstructor'

Joe*_*ugh 2 ecmascript-6 stackblitz

I am trying to use this syntax in StackBlitz:

const someObject = {};
for (let [key, value] of Object.entries(someObject)) {
   // .... do whatever
}
Run Code Online (Sandbox Code Playgroud)

The editor is underlining the entries in red and stating that "Property entries does not exist on type 'ObjectConstructor'".

However the code is still working. It seems to just be a linting issue where the editor thinks this won't work... but it does.

here is the stackblitz if someone could help https://stackblitz.com/edit/angular-validation-errors

How can I get the editor to know the language properly?

Fre*_*e09 8

我发现 Stackblitz 不知道你正在使用哪个版本的 TypeScript。默认情况下 babel 的目标是 es5 规范,但据我所知Object.entries是在 es2017 中添加的。

要解决您的问题,只需将其添加到名为“输入包名称”的输入中的“依赖项”部分中

npm i typescript
Run Code Online (Sandbox Code Playgroud)

或者

typescript
Run Code Online (Sandbox Code Playgroud)

我已经检查过了,现在智能感知工作已经完美