Registry / testing / vue-tsgo

vue-tsgo

JSON →
library0.2.2jsnpmunverified

vue-tsgo is a type checker for Vue Single File Components (SFCs) that integrates with the TypeScript 7 native preview. Designed for Node.js >= 22.12.0, it leverages the @typescript/native-preview package to provide fast and accurate type checking directly on Vue SFC files. Unlike traditional setup where type checking is offloaded to editors or build tools, vue-tsgo runs as a standalone CLI or programmatic API. Version 0.2.2 is the current stable release; the project is in early development with potential breaking changes as TypeScript 7 evolves. It differentiates by focusing solely on SFC type checking without transpilation, making it ideal for CI pipelines and pre-commit hooks.

npm install vue-tsgo
INSTALL
IMPORT
SIG · VUE-TSGO
V
vue-tsgo
testingjavascriptv0.2.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

checkSFC
✓ import { checkSFC } from 'vue-tsgo'
✗ import { checkSFC } from 'vue-tsgo/check'
ESM only; CommonJS require is not supported. checkSFC is the main function exported from the package root.
VueTsgoOptions
✓ import type { VueTsgoOptions } from 'vue-tsgo'
✗ import { VueTsgoOptions } from 'vue-tsgo'
VueTsgoOptions is a TypeScript type, so use type import to avoid runtime overhead.
default (the class)
✓ import VueTsgo from 'vue-tsgo'
✗ const VueTsgo = require('vue-tsgo')
The package provides a default export of the VueTsgo class for programmatic use. CJS require is not supported.

Shows how to use checkSFC to type-check a Vue SFC file, handling errors for exit codes.

import { checkSFC } from 'vue-tsgo'; async function main() { const result = await checkSFC('path/to/component.vue', { typescript: { strict: true, }, }); if (result.errors.length > 0) { console.error('Type errors found:'); for (const err of result.errors) { console.error(err.message); } process.exit(1); } else { console.log('No type errors.'); } } main().catch(console.error);
Debug
Known issues
breakingRequires Node.js >= 22.12.0 for native TypeScript support.
fix
Upgrade Node.js to version 22.12.0 or later.
affects: >=0.0.0
breakingPeer dependency on @typescript/native-preview must be installed separately.
fix
Run npm install @typescript/native-preview to satisfy the peer dependency.
affects: >=0.0.0
deprecatedOptions object structure changed in v0.2.0; previous 'tsconfig' option is now 'typescript.config'.
fix
Replace 'tsconfig' with 'typescript.config' in the options object.
affects: >=0.2.0
gotchaThe checkSFC function does not support CommonJS imports; using require() will fail.
fix
Use ESM import syntax (import { checkSFC } from 'vue-tsgo') or enable ESM in your project.
affects: >=0.0.0
gotchaTypeScript 7 is still in preview; type checking results may differ from stable TypeScript versions.
fix
Be aware of potential inconsistencies; verify with other type checkers if needed.
affects: >=0.0.0
Errors
Common errors & fixes
ERR_REQUIRE_ESM: require() of ES Module /path/to/node_modules/vue-tsgo/index.js from /path/to/your/file.js not supported.
Trying to require() an ES Module with CommonJS require.
fix
Use import statement or set { type: 'module' } in your package.json.
Cannot find module '@typescript/native-preview'
Missing peer dependency @typescript/native-preview.
fix
Install the peer dependency: npm install @typescript/native-preview
Error: Unsupported Node.js version. vue-tsgo requires Node.js >= 22.12.0.
Node.js version is too old (< 22.12.0).
fix
Upgrade Node.js to version 22.12.0 or higher.
TypeError: checkSFC is not a function
Incorrect import (perhaps using default import for named export).
fix
Use import { checkSFC } from 'vue-tsgo' instead of import vueTsgo from 'vue-tsgo'.
Upgrade
Version history
0.2.2latest on npm
Audit
Dependencies
@typescript/native-previewrequiredRequired for TypeScript 7 native preview features. It provides the TypeScript engine for type checking.
Agent activity
12 hits · last 30 days
node
10
Resources
vue-tsgo — npm install vue-tsgo · libregistry