title: Vue Template Directive Comments impact: HIGH impactDescription: enables fine-grained control over template type checking type: capability
Impact: HIGH - enables fine-grained control over template type checking
Vue Language Tools supports special directive comments to control type checking behavior in templates.
Suppress type errors for the next line:
<template>
<!-- @vue-ignore -->
<Component :prop="valueWithTypeError" />
</template>
Assert that the next line should have a type error (useful for testing):
<template>
<!-- @vue-expect-error -->
<Component :invalid-prop="value" />
</template>
Skip type checking for an entire block:
<template>
<!-- @vue-skip -->
<div>
<!-- Everything in here is not type-checked -->
<LegacyComponent :any="props" :go="here" />
</div>
</template>
Declare template-level generic types:
<template>
<!-- @vue-generic {T extends string} -->
<GenericList :items="items as T[]" />
</template>