skip to Main Content

I have a Vue3 app and using VSCode. Using the npm run type-check command will show me the vue-tsc errors. I’m trying to find a way to show these errors in VSCode, like eslint does.

Does anybody know if this possible?

I have the lastest versions of typescript, vue and vue-tsc npm packages, as well as VSCode and the Vue – Official extension.

2

Answers


  1. Chosen as BEST ANSWER

    The issue was that the rootDir and baseUrl values were not configured correctly in the tsconfig.app.json file.

    After changing these settings to the correct values, I get the errors and warnings in VSCode from Volar.


  2. Go to this part of the documentation, and give a try to the following snippet

    <script setup lang="ts">
    import { ref } from 'vue'
    const count = ref('1')
    </script>
    
    <template>
      {{ count.toFixed(2) }}
    </template>
    

    With the official Vue VScode extension (using Volar behind the scenes) + brand new project generated with the Vue CLI, it should work well (works even without asking for TS during the project creation on my side).

    enter image description here

    Feel free to share a Github repo if it doesn’t.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search