san
san

Reputation: 147

Expression expected in PhpStorm

When I try to define callback function using

() => { }

instead of

function () {}

I get this error from PhpStorm

Error

How to fix this?

Upvotes: 10

Views: 4369

Answers (1)

Joe Withey
Joe Withey

Reputation: 991

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.

Upvotes: 11

Related Questions