SFC compiler doesn't support TS 4.5 import { type X }
Version
3.2.22
Reproduction link
Steps to reproduce
With TS 4.5
<script setup type=ts>
import { type Ref } from "vue"
</script>
What is expected?
Compiles
What is actually happening?
Compilation error: Unexpected token, expected ","
https://devblogs.microsoft.com/typescript/announcing-typescript-4-5/#type-on-import-names
@babel/parser
supports this new syntax since 7.16
, our lockfile has it locked at 7.15.8
right now. Hopefully bumping this dep is all it takes?
Until this is supported, use
import type { Ref } from 'vue'
I have problems with that syntax too
UPDATE
I solve it using lang="ts"
on the script setup instead of type="ts"
<script setup lang="ts">