Questions tagged [ecmascript-2016]

Questions about new features specified in the ECMAScript 2016 specification.

This tag targets ECMAScript 2016, a JavaScript standard previously known as ECMAScript 7. Any proposal that reached stage 4 by Jan 28th, 2016 became part of the new version.

These are:

484 questions
0
votes
2 answers

Named default ES6 parameter without destructuration

I'm trying to default options in ES7 using babel. Here is what I can do: class Foo { constructor({key='value', foo='bar', answer=42}) { this.key = key; this.foo = foo; this.number = number; } } This might work for this example, but…
Vinz243
  • 9,654
  • 10
  • 42
  • 86
0
votes
2 answers

How do I disallow use of a required parameter in a ES7 function definition?

Question I am writing a ES7 function that will be called by an API which defines the parameter order: mapStateToProps(state, [ownProps]): stateProps I need to use ownProps but not state. Is it possible to write the function definition so that the…
0
votes
0 answers

How can babel transform ES7 to ES6 only?

JSDos work with ES6 very well, but my project use some ES7 syntax, and JSDoc does not support ES7. I've tried to transform my code to ES5 before pipe to JSDoc, but JSDoc won't work, so I think I should transform every file into ES6 before pipe to…
unbuglee
  • 195
  • 1
  • 11
0
votes
2 answers

How to import from module

One library exports its function in such way: export { default, sitemapBuilder, routesParser, pathsFilter, paramsApplier, } from './lib'; I would like to import them by single line: import { Sitemap, routesParser } from…
Lesha Pipiev
  • 3,251
  • 4
  • 31
  • 65
0
votes
1 answer

Dynamically calling a static method in a JavaScript / ES7 class

I have the className in a string variable. I want to call the addField static method on the dynamic class. const className = "CustomClient"; // comes from dropdown. CustomClient.addField(); CustomClient is the name of the ES7 class. addField is…
vijayst
  • 20,359
  • 18
  • 69
  • 113
0
votes
3 answers

Can I write block of code shorter using ES6/ES7

I have a block of code: const {address, cityDistrict, city, country} = data; const obj = { location: {address, cityDistrict, city, country} }; But can I write this one shorted? I tried this one, but it's wrong: const obj = { location:…
rel1x
  • 2,351
  • 4
  • 34
  • 62
0
votes
0 answers

BabelJS : Why transpilation is not working?

I want to use babelJs to transpile javascript source from es6 ( or es7 ) to es5. So i created a project. Here my package.json file : { "name": "myapp", "version": "1.0.0", "description": "my front end app", "main": "gulpfile.js", …
Pracede
  • 4,226
  • 16
  • 65
  • 110
0
votes
2 answers

react-redux's @connect produces the error 'connect.js:129Uncaught TypeError: Cannot read property 'store' of undefined'

When running my app (successfully bundled with webpack+babel with decorators support), the console shows: 'connect.js:129 Uncaught TypeError: Cannot read property 'store' of undefined' Nothing else is showing on the screen All packages are up to…
Oren Yakobi
  • 279
  • 1
  • 4
  • 14
0
votes
1 answer

Aurelia TypeScript application not working in internet explorer 10

We have created single page application using aurelia framework. We are using es7 decorators in aurelia application. The application works fine in chrome and firefox, but does not working in IE 9,10. But it will works fine in IE 11. The browser…
Jithin Joy
  • 483
  • 4
  • 15
0
votes
1 answer

Babel/ES6 extended class methods undefined

Currently I'm using Babel to write a Node.js backend in ES6. Unfortunately I encountered a strange behaviour when extending a specific class. Some of my methods, defined in the extending class, are undefined. Unless I use the ES7 syntax to bind them…
byCedric
  • 21
  • 1
  • 2
  • 11
0
votes
1 answer

React not loading from babel.rc file

I am receiving a "module parse failed" error when trying to load my react app with Babel6 Stage-1. We initially ran browserify but I am now trying to port us completely to Babel6. babel.rc file { "presets": ["stage-1", "react"], "env": { …
Anthony Chung
  • 1,467
  • 2
  • 22
  • 44
0
votes
1 answer

What's the difference and/or preferred way of updating a deep property?

This is a babel/ES7 question (for redux reducer use) I want to update "dan" only in some properties. What's the preferred way with immutability mind? It seems that only TRY 1 and TRY 3 merge/update correctly. Is there any difference between the…
Gaston Morixe
  • 839
  • 2
  • 10
  • 21
0
votes
1 answer

Babel 6 preset selection to get babel working

I'm using babel 6 with the react plugin and followed the documentation instructions for setting up the transpile process. I've read to get react working I need to use es2015 and react preset. Initially everything worked fine using this both…
Bernhard
  • 4,855
  • 5
  • 39
  • 70
0
votes
2 answers

Exponentiation operator for Boolean in JavaScript?

Refer to this, the exponentiation operator returns the result of raising first operand to the power second operand, like the exponentiation operator in Python, which is part of the ECMAScript 2016 (ES7) proposal. We know the result of Boolean with…
zangw
  • 43,869
  • 19
  • 177
  • 214
0
votes
2 answers

react-native async fetch, undefined error

When calling GetByUsername, the execution jumps to catch block but err is undefined. The api is working because the equivalent promise style code .then().then().done() works, but I'd like to write in this async / await style better. How can I debug…