Registry / serialization / typescript-to-vba

typescript-to-vba

JSON →
library1.0.1jsnpmunverified

TSTVBA is a Node.js CLI tool (v1.0.1) that transpiles TypeScript into VBA modules (.bas and .cls) for Excel/Office automation. It requires Node >=18.0.0 and TypeScript >=5.0.0 as peer dependencies. Key features include class-to-class module mirroring, try/catch-to-On Error mapping, for...of iteration bridging, configurable namespace prefixing, and bundle output with manifest. Unlike generic code generators, it produces real VBA classes, source maps, and integrates directly with tsconfig.json via tstvbaOptions. Maintenance is active on GitHub.

npm install typescript-to-vba
INSTALL
IMPORT
SIG · TYPESCRIPT-TO-VBA
T
typescript-to-vba
serializationjavascriptv1.0.1
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.

tstvba CLI
npx tstvba --init
npm install -g typescript-to-vba && tstvba --init
Global install is optional; use npx to avoid global pollution.
config import
const { transpileProject } = require('typescript-to-vba');
import { transpileProject } from 'typescript-to-vba';
Package is CommonJS only (no ESM build).

Initialize a project, validate config, and transpile a TypeScript file to VBA.

npx tstvba --init # Generates tsconfig.tstvba.json and lib/vbalib.bas stub # Then run: npx tstvba check -p . npx tstvba -p . # Output: dist/vba/MyProject.bas + dist/vba/tstvba-manifest.json
tstvba --version
Debug
Known issues
gotchaNode >=18.0.0 required; older versions (e.g., Node 16) will fail with syntax errors.
fix
Update Node to version >=18.0.0
affects: <18.0.0
gotchaTypeScript peer dependency must be >=5.0.0. Using an older version may break AST traversal.
fix
Install TypeScript >=5.0.0 as a devDependency
affects: >=1.0.0
gotchaGlobal install vs npx: Global install may conflict with project-level TypeScript versions. Use npx to avoid global dependency issues.
fix
Use npx tstvba instead of global install
affects: >=1.0.0
gotchaGenerated .cls files contain metadata headers (VERSION/BEGIN/END + Attribute ...). Copying lines above 'Option Explicit' manually will break class import.
fix
Use VBE -> File -> Import File... to import .cls files
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: Cannot read properties of undefined (reading 'kind')
TypeScript version <5.0.0; AST node shape differs.
fix
Upgrade TypeScript to >=5.0.0
Error: Could not find a valid tsconfig file in path
Missing tsconfig.json or tsconfig.tstvba.json; --init not run.
fix
Run 'npx tstvba --init' to generate tsconfig.tstvba.json
CLI error: 'tstvba' is not recognized as an internal or external command
Global install missing or not in PATH.
fix
Use 'npx tstvba' instead of global binary
Upgrade
Version history
1.0.1latest on npm
Audit
Dependencies
typescriptrequiredPeer dependency; used for type checking and AST parsing
Agent activity
7 hits · last 30 days
node
6
OpenAI (training)
1
Resources
typescript-to-vba — npm install typescript-to-vba · libregistry