Module Parse failed
Hi. I've just started the course and had the node-sass compatibility issue, that was solved but i'm having an issue with the code for Classes, Spread operator, Arrow functions, Immutability
When i save the changes i get the below error
Uncaught Error: Module parse failed: ...\Angular\angular-fundamentals-seed-master\main.ts Unexpected token (26:11) You may need an appropriate loader to handle this file type. | | class ShoppingList2 { | groceries: string[]; | constructor(){ | this.groceries = []; at Object../main.ts (app.js:718) [
] at webpack_require (app.js:660) [ ] at fn (app.js:84) [ ] at Object.7 (app.js:9976) [ ] at webpack_require (app.js:660) [ ] at ./main.ts (app.js:709) [ ] at :4000/build/app.js:712:10 [ ]
Im guessing its some compatability issues but cannot work out which. Ive double checked the code and it looks good to me but here it is just in case
` function ShoppingList() { this.groceries = []; }
ShoppingList.prototype.addItem = function (item) { this.groceries = this.groceries.concat([item]); }
ShoppingList.prototype.removeItem = function([item]){ this.groceries = this.groceries.filter(function(grocery){ return item !== grocery; }) } var mylist = new ShoppingList();
mylist.addItem('Banana'); mylist.addItem('Apple');
console.log(mylist.groceries);
mylist.removeItem('Banana'); console.log(mylist.groceries);
class ShoppingList2 { groceries: string[]; constructor(){ this.groceries = []; } addItem(item){ this.groceries = [...this.groceries, item]; } removeItem(item){ this.groceries = this.groceries.filter((grocery)=> item !== grocery) } }
const myNewList = new ShoppingList2(); myNewList.addItem('Pear'); myNewList.addItem('Pizza');
console.log(myNewList); `
any ideas?