Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeScript syntax does not work in Vue templates #9566

Closed
Demivan opened this issue Mar 6, 2024 · 1 comment · May be fixed by #9567
Closed

TypeScript syntax does not work in Vue templates #9566

Demivan opened this issue Mar 6, 2024 · 1 comment · May be fixed by #9567
Labels
Stale Inactive issues Vue

Comments

@Demivan
Copy link

Demivan commented Mar 6, 2024

🐛 bug report

Compilation fails when using TypeScript syntax in Vue <template>:

<script setup lang="ts">
let x: string | number = 1
</script>

<template>
  {{ (x as number).toFixed(2) }}
</template>

🎛 Configuration (.babelrc, package.json, cli command)

Default config

{
  "scripts": {
    "build": "parcel build index.html"
  },
  "devDependencies": {
    "@parcel/transformer-vue": "2.12.0",
    "parcel": "^2.12.0"
  },
  "dependencies": {
    "vue": "^3.4.21"
  }
}

🤔 Expected Behavior

No error.

😯 Current Behavior

@parcel/transformer-js: Expected ',', got 'as'

  /parcel-vue/src/App.vue:6:8
    5 | <template>
  > 6 |   {{ (x as number).toFixed(2) }}
  >   |        ^
    7 | </template>
    8 | 

💁 Possible Solution

When lang="ts" is specified for the <script>, <template> should be processed using TypeScript too.

🔦 Context

💻 Code Sample

https://github.com/Demivan/parcel-vue/tree/typescript-template

🌍 Your Environment

Software Version(s)
Parcel 2.12.0
Node 21.6.2
pnpm 8.12.1
Operating System Linux (NixOS)
Copy link

github-actions bot commented Oct 2, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs.

@github-actions github-actions bot added the Stale Inactive issues label Oct 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Stale Inactive issues Vue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants