Search code examples
typescriptvue.jsvuejs3

VueJs Typescript ignore typescript error in template block


In my VueJs App everything works as expected. Only thing annoying me is a typescript error in my template block. Is there any option similar to what I would do in my script block?

<script setup lang="ts">
//@ignore-ts
this line will be ignored of typescript errors
</script>

<template>
<!-- @ignore-ts -->
this does not work and this line still has a typescript error
</template>

Solution

  • You can use <!-- @vue-ignore --> #3215. For example:

    <template>
      <!-- @vue-ignore -->
      <HelloWorld :msg="wrongType" />
    
      <!-- @vue-expect-error Describe your error here -->
      <HelloWorld :msg="wrongType" />
    
      <!-- @vue-skip -->
      <SomethingYouDontWantVolarToRecognizeIt>
        ...
      </SomethingYouDontWantVolarToRecognizeIt>
    </template>