Skip to content

vue-tsc reports TS6133 for template-string locals inside helpers used by a VitePress Markdown template #6021

@HowieHz

Description

@HowieHz

Vue - Official extension or vue-tsc version

vue-tsc 3.2.7

VSCode version

N/A. Reproduced with vue-tsc CLI.

Vue version

3.5.32

TypeScript version

6.0.3

System Info

System:
  OS: Windows 11 10.0.26200
  CPU: (24) x64 AMD Ryzen AI 9 HX 370 w/ Radeon 890M
  Memory: 12.04 GB / 31.12 GB
Binaries:
  Node: 25.9.0
  npm: 11.12.1
  pnpm: 10.33.0
Browsers:
  Edge: Chromium (140.0.3485.54)

package.json dependencies

{
  "dependencies": {
    "vue": "^3.5.32"
  },
  "devDependencies": {
    "vitepress": "2.0.0-alpha.17",
    "vue-tsc": "^3.2.7"
  }
}

Steps to reproduce

  1. Open this reproduction project.
  2. Run pnpm install --ignore-workspace.
  3. Run pnpm run typecheck.
  4. Inspect docs/index.md.

What is expected?

vue-tsc should understand that hourValue, start, and end are used inside the returned template string of formatHourLabel(), and that formatHourLabel() is used by the Markdown template.

<script setup lang="ts">
function formatHourLabel(hourValue: number) {
  const start = `${String(hourValue).padStart(2, "0")}:00`;
  const end = `${String(hourValue).padStart(2, "0")}:59`;
  return `${start}-${end}`;
}
</script>

<div>{{ formatHourLabel(1) }}</div>

What is actually happening?

vue-tsc reports TS6133 for the helper parameter and both local variables even though the helper result is rendered by the Markdown template.

docs/.vitepress/config.ts(1,30): error TS2307: Cannot find module 'vitepress' or its corresponding type declarations.
docs/index.md(2,26): error TS6133: 'hourValue' is declared but its value is never read.
docs/index.md(3,9): error TS6133: 'start' is declared but its value is never read.
docs/index.md(4,9): error TS6133: 'end' is declared but its value is never read.

Link to minimal reproduction

https://github.com/HowieHz/vue-tsc-error/tree/main/vitepress-vue-tsc-template-string-locals

Any additional comments?

No response

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

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions