A schema-driven TypeScript → F# bindings generator.
Xantham is a hard fork of Glutinum that tackles the TypeScript-to-.NET bindings problem differently. Instead of a single end-to-end pipeline it separates concerns into extract, encode/decode, and generate phases across Fable and .NET boundaries. The common JSON schema is the only hand-off point; generators consume Xantham.Decoder and never touch the extraction layer.
Both tools read .d.ts files and emit F# bindings. They make different trade-offs.
| Glutinum | Xantham | |
|---|---|---|
| Try it now | Web playground — browser, no install | CLI only — requires Node.js + .NET SDK |
| Setup | Zero | Moderate |
| Input scope | One .d.ts entry point |
Entire type graph, recursively across all referenced files |
| Import statements | Not generated — wired by hand | Generated automatically; provenance is tracked through the full type tree |
| Output style | Single built-in format | User-defined — bring your own strategy (string concat, Fabulous.AST, SyntaxOak, …) |
| Encoder replaceability | N/A — monolithic | TSC can be swapped (e.g. TSGO) without touching decoders or generators |
| Decoder reuse | N/A | Any consumer takes a dependency on Xantham.Decoder independently |
| Complexity | Low | Higher — three distinct phases |
Choose Glutinum when you need a quick answer for a single file and want zero friction.
Choose Xantham when you need the full picture: multi-file type graphs, generated imports, and control over how the output looks.
flowchart LR
A[.d.ts Input] --> B[TypeScript Compiler API]
subgraph Fable / Glutinum
B --> C[GlueAST]
C --> D[FSharpAST]
D --> E[String Concatenation]
end
E --> F[F# Bindings]
flowchart LR
input[.d.ts entry point] --> tsc
subgraph Fable / Xantham.Fable
tsc[TypeScript Compiler API]
crawler[Recursive AST Crawler]
thoth_enc[Thoth Encoder]
tsc --> crawler --> thoth_enc
end
subgraph Common
schema[JSON Schema]
end
schema -.->|contract| thoth_enc
schema -.->|contract| thoth_dec
thoth_enc --> json[JSON]
subgraph .NET / Xantham.Decoder
json --> thoth_dec[Thoth Decoder]
thoth_dec --> util[Utility Layer]
end
util --> types[F# Types]
subgraph Userland Generators
types --> gen1[Xantham.SimpleGenerator\nFabulous.AST]
types --> gen2[Your Generator\nString Concat / SyntaxOak / …]
end
gen1 & gen2 --> out[F# Bindings]
Xantham's extractor follows every type reference recursively. By the time the decoder receives the schema it has the complete type graph — all the information needed to resolve cross-file references and emit accurate open / import statements.
| Module | Role |
|---|---|
| Xantham.Common | Shared discriminated union schema (Common.Types.fs) — the contract between extractor and generators. Included directly as a source file in both Xantham.Fable and Xantham.Decoder; not a separate assembly. |
| Xantham.Fable | TypeScript extractor compiled to JS via Fable. Crawls .d.ts files via ts-morph, merges overloads by TypeKey, and emits JSON conforming to the common schema. |
| Xantham.Fable.Core | Minimal Fable bindings stub. Provides F# representations of TypeScript type-system idioms (keyof, indexed access types, heterogeneous property unions). |
| Xantham.Decoder | .NET library. Decodes the JSON schema into strongly-typed F# structures and provides a utility layer for generator consumption. |
| Xantham.Generator | Core rendering library — path system, type-ref model, and F# AST helpers. |
| Component | Status | Notes |
|---|---|---|
Schema (Xantham.Common) |
🟡 RC | Near-stable; breaking changes require coordinated updates across all layers. |
Reader (Xantham.Fable) |
🟡 RC | Handles large hierarchies (e.g. solid-js). Stack-based traversal avoids JS stack overflows. |
Decoder (Xantham.Decoder) |
🟡 RC | Review documentation and testing. |
Generator (Xantham.Generator) |
🟠 In progress | Structural output works. |