Issue
I created a new Vue project using TypeScript and Vite via
npm init vue@latest
Inside the package.json file there is a typecheck script
"typecheck": "vue-tsc --noEmit -p tsconfig.vitest.json --composite false",
but I don't know its purpose. Should I use this script to ensure that my code is fine? ( E.g. for QA workflows )
Solution
Vite
bundler does not perform type checking; so by default - if there are any errors in your TypeScript
code - Vite
will not complain and transpile it as normal (this is part of the reason why it is so fast).
The "typecheck"
script will do as it's name suggests, check for any TypeScript
errors in your .ts
and .vue
files via the vue-tsc --noEmit
command. It is important to understand that this script will not watch for changes and only run once
per execution. Nevertheless, it is a vital script and should be run as much as possible, especially as part of your CI/CD build process.
It is also worth noting that you can change the start of the script to "tsc --noEmit
to typecheck .ts
files exclusively.
Ref to the documentation.
Answered By - Ovidijus Parsiunas
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.