Questions tagged [ecmascript-2020]

ECMAScript 2020 (ES2020) is the 11th version of the ECMAScript language. It adds many important new features, including dynamic imports, globalThis, optional chaining, arbitrary precision BigInts and Promise.allSettled. Only use this tag where the question specifically relates to new features or technical changes provided in ECMAScript 2020.

ECMAScript 2020 (ES2020) is the 11th version of the language.

The following proposals have been merged:

Links

62 questions
1
vote
0 answers

How can I record audio while using Puppeteer?

Background I am making software that records the audio of streaming seminars. Although I automated to enter a seminar as a user, I haven't found a way to record its audio. What to do I know there are a lot of tools to automate browsing tasks. Of…
1
vote
0 answers

Importing a CommonJS module in a Typescript project exporting ESModules

I am making a NodeJs library in Typescript and I plan to make it support Node@14+. So, I decided to base this project as a ESModule instead of CommonJs. Now there are some libraries required that are CommonJs and I am installing their @types. The…
Sayak Mukhopadhyay
  • 1,332
  • 2
  • 19
  • 34
1
vote
0 answers

Uncaught ReferenceError: Cannot access 'jobTreeReducers' before initialization

In our application we are using Angular(version 10) and ngrx(version 7). My app was running fine till I changed the tsconfig. I changed the below property: "module": "commonjs" to "module": "es2020" From then I started getting the below…
Sai M.
  • 2,548
  • 4
  • 29
  • 46
1
vote
3 answers

How to flat array of object in es6?

I've a array of object like. i want to extract nested object and return it as expected output. My approach is already not working and also not sure its efficient to iterating on large set of data. const data = [ { name: 'Micheal', …
Mr. Learner
  • 978
  • 2
  • 18
  • 48
1
vote
2 answers

What‘s the difference between "identifier" and "identifierName" in ECMAScript 2020?

https://262.ecma-international.org/11.0/#prod-IdentifierName I don't undestand well the difference between "identifier" and "identifierName" in ECMAScript 2020.
1
vote
0 answers

double question mark vs && in javascript

here's what the purpose of using ?? //Similar to || but only returns the right-hand operand if the left-hand is null or undefined 0 ?? "other" // 0 false ?? "other" // false null ?? "other" // "other" undefined ?? "other" // "other" but I normally…
1
vote
2 answers

Getting export declarations may only appear at top level of a module in JavaScript when exporting

No matter where I put the export statement I get the same error export declarations may only appear at top level of a module I've tried adding type="module" to the script tag but it didn't help and I'm trying to avoid it. JS: export { LogTypes,…
SteinTheRuler
  • 3,549
  • 4
  • 35
  • 71
1
vote
1 answer

How to enable ES2020 in react-native app?

I was trying to add ES2020 features in my react-native app, I installed "babel-preset-es2020": "^1.0.2" and added .babelrc file like this: { "presets": ["es2020"] } But nothing seems to work, this error is coming there: error: Error: Unable to…
1
vote
1 answer

can someone explain me why the grammar of for, while, do-while statement define that the condition part within the header is an "Expression"

Can someone explain to me why the grammar of for, while, do-while statement's define that the condition part within the header is an "Expression" and can someone explain me what the below thing means Expression[In, Yield, Await] : …
Kevin
  • 209
  • 2
  • 11
1
vote
1 answer

Can someone explain me the Syntax of a loop like "for (;;)"

Can someone explain me the Syntax of a for-loop like "for (;;)" what i need to know is whether the header of a for-loop like "for (;;)" is having empty-statements or not. I searched the ECMAScript specification about what will happen if all the…
Kevin
  • 209
  • 2
  • 11
1
vote
1 answer

ES2020 private class methods/fields and testing

As you may know, ES2020 is introducing private class methods and fields, similar to what we have currently in typescript (albeit a different keyword... TS -> private | JS -> #methodName or #fieldName). Link to the RC (stage…
leelium
  • 47
  • 1
  • 1
  • 6
1
vote
1 answer

I can't use new feature ES 2020 in my next.js app

I wanted to use a new feature of ES 2020 in my next.js so I used optional changes in my app. When I ran my code this error has occurred Module parse failed: Unexpected token (50:191) You may need an appropriate loader to handle this file…
S. Hesam
  • 5,266
  • 3
  • 37
  • 59
1
vote
1 answer

What exactly the "LeftFirst" Boolean Flag is in "Abstract Relational Comparison Algorithm" in ECMAScript?

Can someone explain what exactly the LeftFirst Boolean Flag is in Abstract Relational Comparison Algorithm in ECMAScript? I know that there is only one operator < handling all other relational operators like >, >=, <= as mentioned in the ECMAScript…
1
vote
2 answers

Can someone explain me what is the "LeftFirst" Boolean flag they have defined in the ecmaScript specification

Can someone explain to me what is the LeftFirst Boolean flag? when reading the EcmaScript specification about [relational-operators](https://tc39.es/ecma262/#sec-relational-operators" relational-operators definition in ECMAScript") and Abstract…
Kevin
  • 209
  • 2
  • 11
0
votes
1 answer

Working with native dynamic ES2020 modules in TypeScript (without Node.js) and typing things

I have a TypeScript application working with es16 modules, most of them are imported statically. I want to use a (validator-) module now that is only imported in debug mode. It's all working, but I don't understand how to type things so that I get…
iDad
  • 39
  • 4