vue-tsc
v3.2.6
Published
<p> <a href="https://www.npmjs.com/package/vue-tsc"><img src="https://img.shields.io/npm/v/vue-tsc.svg?labelColor=18181B&color=1584FC" alt="NPM version"></a> <a href="https://github.com/vuejs/language-tools/blob/master/LICENSE"><img src="https://img.s
Readme
vue-tsc
A command-line type checking tool for Vue, based on a tsc wrapper, enabling the TypeScript compiler to understand .vue files.
Installation
npm install vue-tsc typescript --save-devRequires TypeScript 5.0.0 or higher.
Usage
Type Checking
vue-tsc --noEmitGenerate Declaration Files
vue-tsc --declaration --emitDeclarationOnlyConfiguration in package.json
{
"scripts": {
"type-check": "vue-tsc --noEmit",
"build:types": "vue-tsc --declaration --emitDeclarationOnly"
}
}Supported File Types
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.
Differences from tsc
vue-tsc is a wrapper around tsc that:
- Reads
vueCompilerOptionsfromtsconfig.json - Creates a Vue language plugin to process
.vuefiles - Transforms
.vuefiles into TypeScript virtual code before passing them totsc
All tsc command-line arguments can be used directly.
Programmatic Usage
import { run } from 'vue-tsc';
// Use the default tsc path
run();
// Specify a custom tsc path
run('/path/to/typescript/lib/tsc.js');Related Packages
@vue/language-core- Core module
License
MIT License
