Questions tagged [ecmascript-next]

For questions about upcoming ECMAScript features that are not scheduled to be part of a specific version yet (anything that is a stage 3 or lower proposal).

Proposals for new ECMAScript features follow a specific process, where they go through the following stages:

  • Stage 0 (Strawman)
  • Stage 1 (Proposal): The committee expects to devote time to examining the problem space, solutions and cross-cutting concerns
  • Stage 2 (Draft): The committee expects the feature to be developed and eventually included in the standard
  • Stage 3 (Candidate): The solution is complete and no further work is possible without implementation experience, significant usage and external feedback.
  • Stage 4 (Finished): The addition will be included in the soonest practical standard revision

Proposals in stage 4 are definitely added to one of the next releases of the language specification. This tag is for questions about proposals in stage 0 - stage 3.

Important Links:

405 questions
29
votes
7 answers

TypeError: Object.entries is not a function

Why do I keep getting this error when trying to run my Node.js/Express server? Is this a part of the newer ES7? What do I need to be able to run an app using these new features?
user7917402
28
votes
5 answers

Clean way to keep original variable and destructure at the same time

Is there a cleaner way to do this (with anything that is at least an ES draft and has a babel plugin, i.e., ES6, ES7, etc.): const { a, b } = result = doSomething(); Where I want to keep the overall result as one singular object, but also…
samanime
  • 25,408
  • 15
  • 90
  • 139
27
votes
6 answers

What is the shortest way to modify immutable objects using spread and destructuring operators

I'm looking for a pure function, to modify my immutable state object. The original state given as parameter must stay untouched. This is especially useful when working with frameworks like Redux and makes working with immutable object in javascript…
Tarion
  • 16,283
  • 13
  • 71
  • 107
26
votes
1 answer

Mapping of Node.js version to ECMAScript version

Is there a mapping somewhere from Node.js version, e.g. 0.10, or 14, to the corresponding ECMAScript version, e.g. ES5, ES2020? As this question is closed, I can't post the solution I came up with as an answer, so it is here…
balupton
  • 47,113
  • 32
  • 131
  • 182
26
votes
2 answers

Why are derived class property values not seen in the base class constructor?

I wrote some code: class Base { // Default value myColor = 'blue'; constructor() { console.log(this.myColor); } } class Derived extends Base { myColor = 'red'; } // Prints "blue", expected "red" const x = new…
Ryan Cavanaugh
  • 209,514
  • 56
  • 272
  • 235
26
votes
3 answers

How can I use decorators today?

I see decorators being used today already in some javascript code. My question is really two fold. First: If decorators have not even been finalized how is it possible to use them in production code, today? Won't browser support be…
25
votes
1 answer

Using latest JavaScript features in TypeScript, such as ES2018

I have tried searching through TypeScripts documentation on their configurtion and can't seem to find the answer to what should be a simple question. Simply, how does one configure the typescript compiler so that it knows what JavaScript feature…
ste2425
  • 4,656
  • 2
  • 22
  • 37
25
votes
4 answers

Babel support for Object.entries

I'm looking at the stage 3 proposal of Object.values/Object.entries and I'd really like to use it in my current JavaScript project. However, I can't figure out whether there's any Babel preset which supports it. Since the GitHub repository linked…
damd
  • 6,116
  • 7
  • 48
  • 77
24
votes
1 answer

Why So Many IANA Time Zones Names?

Javascript allows you to see what time it is in another timezone if you specify the IANA given name of that timezone. For example: let strTime = new Date().toLocaleString("en-US", {timeZone: "America/Chicago"}); console.log(strTime); Below you…
Lonnie Best
  • 9,936
  • 10
  • 57
  • 97
21
votes
2 answers

Unable to use Arrow functions inside React component class

I've started a project where I use React JS for the front end an node js in backend. I used webpack for bundling up JS files. I used babel along with other necessary stuff. When I use arrow functions inside a react class, it gives a syntax error,…
TRomesh
  • 4,323
  • 8
  • 44
  • 74
20
votes
1 answer

How do I use and apply JavaScript decorators?

I am trying to understand how to use decorators in a very simple piece of code, so I can apply this concept to my bigger project. Taking cue from Addy Osmani's article here, I created a simple piece of code as below. Say, I have a class called Cat,…
Mopparthy Ravindranath
  • 3,014
  • 6
  • 41
  • 78
20
votes
4 answers

How to use async await function object in Javascript?

Say I have a function object- setObj : function(a,b){ obj.a = a; obj.b = b; } If I have to use async & await on this function object, how do I do it? If the same was written in function (function way), say- async function setObj(a,b){ …
bozzmob
  • 12,364
  • 16
  • 50
  • 73
19
votes
2 answers

Spread syntax ES6 with statement

I tried to write ternary operator with spread syntax and copy two objects. Is it possible to use ternary operator with spread syntax inside with literal objects? My code works okay, I just want to optimize it. hintStyle: disabled ?…
Palaniichuk Dmytro
  • 2,943
  • 12
  • 36
  • 66
17
votes
1 answer

Adding a key from a variable string (es6) when using spread syntax

I would like to know if there is a clean way to set the value of a key from a string variable when using spread syntax in es6? Something like the following: let keyVar = 'newKey' let newObject = {keyVar:{some:'json'},...oldObject} But this leads…
JasoonS
  • 1,432
  • 3
  • 13
  • 26
16
votes
6 answers

ESLint unexpected character '@' for JS decorators

I'm trying to use decorators in my JS project, however ESLint is throwing an error stating that the @ symbol is a unexpected character. My code: @observable items = []; My .eslintrc: { "parserOptions": { "ecmaVersion": 6, …
user818700
1 2
3
26 27