-
-
Notifications
You must be signed in to change notification settings - Fork 407
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
props on template
are not checked
#4539
Comments
template
template
are not checked
Input <script setup lang="ts"></script>
<template>
<template v-if="true" :key="">
<div></div>
</template>
<template v-if="true" :key="{}">
<div></div>
</template>
<div v-if="true" :key=""></div>
<div v-if="true" :key="{}"></div>
</template> Output // ...
if (true) {
__VLS_elementAsFunction(__VLS_intrinsicElements.div, __VLS_intrinsicElements.div)({});
}
if (true) {
__VLS_elementAsFunction(__VLS_intrinsicElements.div, __VLS_intrinsicElements.div)({});
}
if (true) {
__VLS_elementAsFunction(__VLS_intrinsicElements.div, __VLS_intrinsicElements.div)({key: ((__VLS_ctx.)), });
// @ts-ignore
[,];
}
if (true) {
__VLS_elementAsFunction(__VLS_intrinsicElements.div, __VLS_intrinsicElements.div)({key: (({})), });
}
// ... Should? // ...
if (true) {
- __VLS_elementAsFunction(__VLS_intrinsicElements.div, __VLS_intrinsicElements.div)({});
+ __VLS_elementAsFunction(__VLS_intrinsicElements.div, __VLS_intrinsicElements.div)({key: ((undefined))});
}
if (true) {
- __VLS_elementAsFunction(__VLS_intrinsicElements.div, __VLS_intrinsicElements.div)({});
+ __VLS_elementAsFunction(__VLS_intrinsicElements.div, __VLS_intrinsicElements.div)({key: (({}))});
}
if (true) {
- __VLS_elementAsFunction(__VLS_intrinsicElements.div, __VLS_intrinsicElements.div)({key: ((__VLS_ctx.)), });
+ __VLS_elementAsFunction(__VLS_intrinsicElements.div, __VLS_intrinsicElements.div)({key: ((undefined))});
// @ts-ignore
[,];
}
if (true) {
__VLS_elementAsFunction(__VLS_intrinsicElements.div, __VLS_intrinsicElements.div)({key: (({})), });
}
// ... |
A |
Ah, it's not working for |
Should be fixed by cb54032? Do you mean there is no type checking? |
Yeah it's not there for key. This should've shown error in line 3: <script setup lang="ts"></script>
<template>
<template v-for="x in [1]" :key="{}">
<div>{{ x }}</div>
</template>
</template> |
Got it 👐 |
My PR doesn't report |
Ah yeah. It can be left I guess. I'll track it on the core repo. Looks like compiler-dom is generating invalid JS for |
Yeah, |
Vue - Official extension or vue-tsc version
2.0.26
VSCode version
1.92.0-insider
Vue version
3.4.31
TypeScript version
5.5.3
System Info
No response
Steps to reproduce
git clone [email protected]:brc-dd/volar-template-key-bug.git
pnpm i
pnpm vue-tsc --noEmit
Pasting here for completeness:
What is expected?
Error on line 4, 5, 7, 8 of
Foo.vue
What is actually happening?
Error is only on line 7, 8.
There should be an error on line 4 saying
v-bind is missing expression.
There should be an error on line 5 saying
Type '{}' is not assignable to type 'PropertyKey | undefined'.
Link to minimal reproduction
https://github.com/brc-dd/volar-template-key-bug
Any additional comments?
Is it possible to show
vue
errors when runningvue-tsc
? They are currently shown only in the editor. (Line 7 in the above example.)The text was updated successfully, but these errors were encountered: