jeudi 25 août 2016

JavaScript ES6 - ERROR: You can only use decorators on an export when exporting a class

I am trying to export a function in ES6 so I can import it and use it in other files to have a DRY code. However I receive the following error:

You can only use decorators on an export when exporting a class (16:0) while parsing file:

export function totalItems() {
    this.cart.items.forEach((dish) => total += item.qty);
    return total;
}

Any ideas?

Aucun commentaire:

Enregistrer un commentaire