$ cnpm install vue-tsc
A command-line type checking tool for Vue, based on a tsc wrapper, enabling the TypeScript compiler to understand .vue files.
npm install vue-tsc typescript --save-dev
Requires TypeScript 5.0.0 or higher.
vue-tsc --noEmit
vue-tsc --declaration --emitDeclarationOnly
{
"scripts": {
"type-check": "vue-tsc --noEmit",
"build:types": "vue-tsc --declaration --emitDeclarationOnly"
}
}
vue-tsc automatically reads file types to process from vueCompilerOptions.extensions in tsconfig.json, defaulting to ['.vue'].
If vitePressExtensions or petiteVueExtensions are configured, those extensions will also be processed.
vue-tsc is a wrapper around tsc that:
vueCompilerOptions from tsconfig.json.vue files.vue files into TypeScript virtual code before passing them to tscAll tsc command-line arguments can be used directly.
import { run } from 'vue-tsc';
// Use the default tsc path
run();
// Specify a custom tsc path
run('/path/to/typescript/lib/tsc.js');
@vue/language-core - Core moduleMIT License
Copyright 2013 - present © cnpmjs.org | Home |