Skip to content

@vue-ignore not working with v-else #5729

@downace

Description

@downace

Vue - Official extension or vue-tsc version

3.1.2

VSCode version

Vue version

3.5.13

TypeScript version

5.9.3

System Info

package.json dependencies

Steps to reproduce

  1. Create Vue component with error at the same node as v-else and try to suppress the error with @vue-ignore:
<template>
  <div v-if="condition"></div>
  <!-- @vue-ignore -->
  <div v-else :class="unknownProp"> Test </div>
</template>

<script setup lang="ts">
import { shallowRef } from 'vue';
const condition = shallowRef(false);
</script>
  1. Run vue-tsc (e.g. ./node_modules/.bin/vue-tsc --noEmit)

What is expected?

Error should be suppressed

What is actually happening?

Error is reported as if there were not @vue-ignore directive:

frontend/components/TestComponent.vue:6:13 - error TS2339: Property 'unknownProp' does not exist on type '{ condition: boolean; $: ComponentInternalInstance; $data: {}; $props: {}; $attrs: Data; $refs: Data; $slots: Readonly<InternalSlots>; ... 19 more ...; $router: Router; }'.

6     :class="unknownProp"
              ~~~~~~~~~~~


Found 1 error in frontend/components/TestComponent.vue:6

Workaround: use v-if="!condition" instead of v-else

Link to minimal reproduction

No response

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

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions