Ad

Expression Expected In PhpStorm

- 1 answer

When I try to define callback function using

() => { }

instead of

function () {}

I get this error from PhpStorm

Error

How to fix this?

Ad

Answer

In the menu:

PhpStorm > Preferences > Languages & Frameworks > Javascript

You'll see a box that says: JavaScript Language Version.

You should be able to change the option to ECMAScript 6 and apply.

Also:

PhpStorm > Preferences > Editor > File Types Find ECMAScript 6 in the list and add *.vue to the registered patterns list. You could add it to the Javascript file type to for good measure.

Ad
source: stackoverflow.com
Ad