A library for embedding the TypeScript compiler directly into Node.js or browser applications, providing programmatic compilation, custom transformers, and detailed diagnostics. Current stable version is 3.1.0, with monthly updates. It supports dynamic code compilation without external build tools, includes a CLI for collecting external type definitions from npm packages, and offers a rich diagnostic API. Compared to alternatives like ts-node or esbuild-register, it is designed for in-process compilation with fine-grained control over transformations and error reporting.
npm install embed-typescriptNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Creates an EmbedTypeScript instance with TypeScript options and external type definitions, compiles a string, and handles success or failure.
Install TypeScript 5.x or 6.x: npm install typescript@^5.0.0
Use npx embed-typescript external --input <dir> --output <file>
Use npx embed-typescript external to generate external.json from npm packages
Set skipLibCheck: true in EmbedTypeScript constructor options
Watch changelog for updates or avoid using fountain function in production
Run: npm install typescript
Change to: import { EmbedTypeScript } from 'embed-typescript'Ensure embed-typescript >=3.0.0 and import type correctly: import type { IEmbedTypeScriptResult } from 'embed-typescript'Run: npm install embed-typescript