Reputation: 133
I'm working in PhpStorm on a Vue 2 / TypeScript project where whenever I want to include return types on functions I get "Types are not supported by current JavaScript version":
On "Preferences > Languages and Frameworks > JavaScript", I have ECMAScript 6+
selected:
I've tried restarting the IDE to no avail.
Any ideas?
Upvotes: 6
Views: 7216
Reputation: 12186
I had the same error, but it happened because I was writing Typescript code in a .js
file instead of .ts
file.
.js
to .ts
Upvotes: 3
Reputation: 133
Ah, apparently I was misled by the wording of the error message. Simply adding <script lang="ts">
inside my vue files has fixed it.
Upvotes: 6