Thanks to visit codestin.com
Credit goes to github.com

Skip to content

escaton/vue-tsc-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@esctn/vue-tsc-api

A (very) simple wrapper that exposes vue-tsc's programmatic API for use in build tools and other TypeScript-related tooling.

Why does this package exist?

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').

Installation

npm install @esctn/vue-tsc-api

The typescript@>=5.0.0 and vue-tsc@~3.0.3 are peer dependencies.

Usage

The package exports the same api as typescript/lib/typescript but with vue-tsc patches to support Vue SFC.

Example with webpack ts-checker

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'
      }
    })
  ]
};

Example with custom TypeScript checker

const typescript = require('@esctn/vue-tsc-api');

// use as a regular TypeScript api

License

ISC

Contributing

Issues and pull requests are welcome on GitHub.

Related

  • vue-tsc - Vue 3 command line Type-Checking tool
  • Volar.js - The infrastructure behind vue-tsc
  • TypeScript - The TypeScript language and compiler

About

Expose vue-tsc programmatic api

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published