Starting from v0.36 of vue-tsc, the generated declaration files of SFCs are broken.
Reproduction
I'm using the default project that is scaffolded by create-vite-app, but manually upgraded vue-tsc to the latest version. I also removed the env.d.ts file according to this comment and use vue-tsc --declaration --emitDeclarationOnly to generate the type declarations.
components/HelloWorld.vue
<scriptlang="ts"setup>import { ref } from'vue'defineProps<{ msg:string }>()const count =ref(0)</script>
<template>
<h1>{{ msg }}</h1>
<p>
Recommended IDE setup:
<ahref="https://code.visualstudio.com/"target="_blank">VS Code</a>
+
<ahref="https://github.com/johnsoncodehk/volar"target="_blank">Volar</a>
</p>
<p>See <code>README.md</code> for more information.</p>
<p>
<ahref="https://vitejs.dev/guide/features.html"target="_blank">
Vite Docs
</a>
|
<ahref="https://v3.vuejs.org/"target="_blank">Vue 3 Docs</a>
</p>
<buttontype="button" @click="count++">count is: {{ count }}</button>
<p>
Edit
<code>components/HelloWorld.vue</code> to test hot module replacement.
</p>
</template>
<stylescoped>a {color: #42b983;}label {margin: 00.5em;font-weight: bold;}code {background-color: #eee;padding: 2px4px;border-radius: 4px;color: #304455;}</style>
Output
The generated HelloWorld.vue.d.ts is different between v0.35 and v0.36 of vue-tsc.
Problem is this line: $slots: typeof import('./HelloWorld.vue.__VLS_template').default; that is generated by v0.36. I'm not sure why this is happening but I think one of these two commits causes the issue:
I guess __VLS_template is a placeholder that should be replaced like the other __VLS_* placeholders but I couldn't exactly figure out the internals to patch this by myself.
Starting from v0.36 of
vue-tsc
, the generated declaration files of SFCs are broken.Reproduction
I'm using the default project that is scaffolded by
create-vite-app
, but manually upgradedvue-tsc
to the latest version. I also removed theenv.d.ts
file according to this comment and usevue-tsc --declaration --emitDeclarationOnly
to generate the type declarations.components/HelloWorld.vue
Output
The generated
HelloWorld.vue.d.ts
is different between v0.35 and v0.36 of vue-tsc.v0.35
v0.36
Problem
Problem is this line:
$slots: typeof import('./HelloWorld.vue.__VLS_template').default;
that is generated by v0.36. I'm not sure why this is happening but I think one of these two commits causes the issue:Workaround
Don't use
<script setup>
.Output
The text was updated successfully, but these errors were encountered: