{"id":26555,"library":"typescript-to-vba","title":"TypeScript to VBA Transpiler","description":"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.","status":"active","version":"1.0.1","language":"javascript","source_language":"en","source_url":"https://github.com/YourUsername/typescript-to-vba","tags":["javascript","typescript","vba","excel","transpiler","tstvba"],"install":[{"cmd":"npm install typescript-to-vba","lang":"bash","label":"npm"},{"cmd":"yarn add typescript-to-vba","lang":"bash","label":"yarn"},{"cmd":"pnpm add typescript-to-vba","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency; used for type checking and AST parsing","package":"typescript","optional":false}],"imports":[{"note":"Global install is optional; use npx to avoid global pollution.","wrong":"npm install -g typescript-to-vba && tstvba --init","symbol":"tstvba CLI","correct":"npx tstvba --init"},{"note":"Package is CommonJS only (no ESM build).","wrong":"import { transpileProject } from 'typescript-to-vba';","symbol":"config import","correct":"const { transpileProject } = require('typescript-to-vba');"}],"quickstart":{"code":"npx tstvba --init\n# Generates tsconfig.tstvba.json and lib/vbalib.bas stub\n# Then run:\nnpx tstvba check -p .\nnpx tstvba -p .\n# Output: dist/vba/MyProject.bas + dist/vba/tstvba-manifest.json","lang":"typescript","description":"Initialize a project, validate config, and transpile a TypeScript file to VBA."},"warnings":[{"fix":"Update Node to version >=18.0.0","message":"Node >=18.0.0 required; older versions (e.g., Node 16) will fail with syntax errors.","severity":"gotcha","affected_versions":"<18.0.0"},{"fix":"Install TypeScript >=5.0.0 as a devDependency","message":"TypeScript peer dependency must be >=5.0.0. Using an older version may break AST traversal.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use npx tstvba instead of global install","message":"Global install vs npx: Global install may conflict with project-level TypeScript versions. Use npx to avoid global dependency issues.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use VBE -> File -> Import File... to import .cls files","message":"Generated .cls files contain metadata headers (VERSION/BEGIN/END + Attribute ...). Copying lines above 'Option Explicit' manually will break class import.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Upgrade TypeScript to >=5.0.0","cause":"TypeScript version <5.0.0; AST node shape differs.","error":"TypeError: Cannot read properties of undefined (reading 'kind')"},{"fix":"Run 'npx tstvba --init' to generate tsconfig.tstvba.json","cause":"Missing tsconfig.json or tsconfig.tstvba.json; --init not run.","error":"Error: Could not find a valid tsconfig file in path"},{"fix":"Use 'npx tstvba' instead of global binary","cause":"Global install missing or not in PATH.","error":"CLI error: 'tstvba' is not recognized as an internal or external command"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}