“Types are not supported by current JavaScript version” in PhpStorm

Total
10
Shares

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":

Types are not supported by current JavaScript version

On "Preferences > Languages and Frameworks > JavaScript", I have ECMAScript 6+ selected:

selected

I’ve tried restarting the IDE to no avail.

Any ideas?


Solution

Ah, apparently I was misled by the wording of the error message. Simply adding <script lang="ts"> inside my vue files has fixed it.

Leave a Reply

Your email address will not be published. Required fields are marked *