Skip to content

Failing to parse pug function call inside a conditional named template slot (regression since 3.1.6) #5914

@IlyaSemenov

Description

@IlyaSemenov

Vue - Official extension or vue-tsc version

3.2.1

VSCode version

  • (repeatable in command line, no need to have VSCode)

Vue version

3.5.26

TypeScript version

5.9.3

System Info

System:
    OS: Linux 5.0 undefined
    CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 0 Bytes / 0 Bytes
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 20.19.1 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 10.8.2 - /usr/local/bin/npm
    pnpm: 8.15.6 - /usr/local/bin/pnpm

package.json dependencies

"dependencies": {
    "vue": "^3.5.26",
    "vue-router": "^4.6.4"
  },
  "devDependencies": {
    "@vue/language-plugin-pug": "^3.2.1",
    "nuxt": "^3.20.2",
    "pug": "^3.0.3",
    "typescript": "^5.9.3",
    "vue-tsc": "^3.2.1"
  }

Steps to reproduce

<script setup lang="ts">
function getNumber() {
  return 123;
}
</script>

<template lang="pug">
test-view
  template(v-if="true" #help)
    | {{ getNumber() }}
</template>

From what I've tested, all parts are required: it should be a non-default slot with v-if, and a function call.

In the minimal reproduction at Stackblitz (see link below), this code is inside app.vue. To repeat the bug, simply run:

pnpm nuxt typecheck

What is expected?

No error during type check — the code is valid.

What is actually happening?

❯ pnpm nuxt typecheck

 ERROR  (node:30) ExperimentalWarning: WASI is an experimental feature and might change at any time          4:11:38 PM
(Use node --trace-warnings ... to show where the warning was created)

app.vue:10:22 - error TS1005: ')' expected.

10     | {{ getNumber() }}
                        ~


Found 1 error in app.vue:10

Link to minimal reproduction

https://stackblitz.com/edit/nuxt-starter-yl6fbd5x

Any additional comments?

I bisected this to be a regression introduced in vue-tsc 3.1.6. The code is handled fine in 3.1.5 and earlier.

Metadata

Metadata

Assignees

No one assigned

    Labels

    good reproduction ✨This issue provides a good reproduction, we will be able to investigate it first🔨 p3-minor-bug

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions