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 )
CodePudding user response:
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 errors in your TypeScript
and Vue
code. You can change the start to "tsc --noEmit
if you want to only check the TypeScript
files. Nevertheless this is a vital script and it should be run as much as possible, especially as part of your CI/CD build process.
Ref to the documentation.