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

[Bug] Typescript code in Vue template is not formatted #14432

Closed
wenfangdu opened this issue Mar 1, 2023 · 4 comments · Fixed by #14506
Closed

[Bug] Typescript code in Vue template is not formatted #14432

wenfangdu opened this issue Mar 1, 2023 · 4 comments · Fixed by #14506
Labels
lang:vue Issues affecting Vue locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. type:bug Issues identifying ugly output, or a defect in the program

Comments

@wenfangdu
Copy link
Contributor

wenfangdu commented Mar 1, 2023

Prettier 2.8.4
Playground link

--parser vue

Input:

<script lang="ts"></script>

<template>
  <comp :foo="(a:string)=>1"/>
</template>

Output:

<script lang="ts"></script>

<template>
  <comp :foo="(a:string)=>1" />
</template>

Expected behavior:

<script lang="ts"></script>

<template>
  <comp :foo="(a: string) => 1" />
</template>
@fisker fisker added type:bug Issues identifying ugly output, or a defect in the program lang:vue Issues affecting Vue labels Mar 1, 2023
@fisker
Copy link
Member

fisker commented Mar 1, 2023

We only support typescript syntax when there are scripts with [lang="typescript"], but this still a bug. Updated code example to add a <script> block.

@seiyab
Copy link
Sponsor Contributor

seiyab commented Mar 14, 2023

@wenfangdu
Would you try the playground of #14506 ?
I'm not familiar with Vue enough.

@wenfangdu
Copy link
Contributor Author

@seiyab Thanks, it seems to be working:
image

@sosukesuzuki
Copy link
Member

Fixed by #14587

@github-actions github-actions bot added the locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. label Nov 25, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lang:vue Issues affecting Vue locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. type:bug Issues identifying ugly output, or a defect in the program
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants