Electron's documentation (for example http://electron.atom.io/docs/api/browser-window/) says to import some features using a destructuring statement:
const {BrowserWindow} = require('electron')
This works when running the code in Electron but Jasmine and Visual Studio* claim that the "{" is a syntax error.
What is the correct usage?
*The code is actually written in Typescript (1.8 targeting ES2015) but the transpiled code in JS is identical in this case.
This code is valid ES6/ES2015, but is not valid ES5.
Destructuring assignments are supported in node.js >= 6.4. If your Jasmine is run with an older version, it will not work. Not sure about Visual Studio, but it looks like you need a recent version of VS 2015 to be able to have ES6 features.
Therefore you should either update your tools, or just configure Typescript so it targets ES5 instead.