A (very) simple wrapper that exposes vue-tsc's programmatic API for use in build tools and other TypeScript-related tooling.
The vue-tsc maintainers have intentionally kept vue-tsc as a CLI-only tool to maintain its single purpose and avoid confusion. However, some build tools and TypeScript checkers (like fork-ts-checker-webpack-plugin, ts-checker-rspack-plugin) need programmatic access to vue-tsc's TypeScript compiler to work with Vue SFCs.
The content of this package is literally one line, and if you think that installing an npm package for it is too much, I feel you!
I published it purely for ergonomics — feel free to just copy the file in your project, and use require.resolve('path/to/your-wrapper.js').
npm install @esctn/vue-tsc-apiThe typescript@>=5.0.0 and vue-tsc@~3.0.3 are peer dependencies.
The package exports the same api as typescript/lib/typescript but with vue-tsc patches to support Vue SFC.
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
module.exports = {
// ... your webpack config
plugins: [
new ForkTsCheckerWebpackPlugin({
typescript: {
// Use @esctn/vue-tsc-api instead of regular TypeScript
typescriptPath: '@esctn/vue-tsc-api'
}
})
]
};const typescript = require('@esctn/vue-tsc-api');
// use as a regular TypeScript apiISC
Issues and pull requests are welcome on GitHub.
- vue-tsc - Vue 3 command line Type-Checking tool
- Volar.js - The infrastructure behind
vue-tsc - TypeScript - The TypeScript language and compiler