Skip to content

Type assertions in <template> are not stripped away with <script lang="tsx"> #5764

@DrJume

Description

@DrJume

Version

3.2.33

Reproduction link

https://stackblitz.com/edit/vue-issue-repro-5764?file=src/App.vue&terminal=dev

Steps to reproduce

  1. Create a component with <script lang="tsx">.
  2. Use a TypeScript type assertion as or : inside a prop binding in <template>.

What is expected?

TypeScript type assertions are compiled away as with <script lang="ts">.

What is actually happening?

Inside a Vue 3 SFC when using <script lang="tsx"> TS type assertions are not stripped away in the <template>, which leads to an 'Unexpected identifier' SyntaxError in the browser, because type assertion syntax is not valid JS.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions