Xantham is a TypeScript-to-F# bindings generator that separates concerns into three phases:
- Extract (Fable/JavaScript) - Crawls TypeScript AST and serializes as JSON
- Transport - Common JSON schema
- Decode & Generate (.NET) - Deserializes JSON into F# structures and runs generators
npm run prestart- Compile Fable extractornpm start- Run extractor against .d.ts filenpm run watch- Development watch mode (Fable + Node)npm run test:signal- Run standalone Fable testsdotnet build- Build .NET projectsdotnet test- Run .NET tests
Xantham.Fable- TypeScript extractor (Fable/F# to JS)Xantham.Decoder- .NET library for decoding JSON schemaXantham.Generator- Core rendering libraryXantham.Common- Shared schema definitions (included directly, not compiled separately)tests/Xantham.Fable.Tests- Fable/Mocha integration tests with .d.ts fixtures
- Extract:
npm run prestart && npm start <path/to/index.d.ts> - Decode & Generate:
dotnet run --project src/Xantham.SimpleGenerator - Watch mode:
npm run watchfor development
- All projects target
net10.0 - Test fixtures are actual
.d.tsfiles intests/Xantham.Fable.Tests/TypeFiles/ Xantham.Common/Common.Types.fsis included directly in both Fable and Decoder projects- Generated code uses Thoth.Json for serialization
- Fable 5.0.0-rc.# is used for F# to JS compilation
- Fable.Mocha is used for Fable tests, Expecto for .NET tests
- Computed signals start dirty - always read
.Valuebefore subscribing to.Invalidatedin tests
src/Xantham.Fable/Program.fs.js- Entry point for extractorsrc/Xantham.Common/Common.Types.fs- Core schema definitionssrc/Xantham.SimpleGenerator/Program.fs- Example generator implementationtests/Signal.test.fsx- Standalone Fable test script
- Schema is the single hand-off point between extractor and generators
- Generators consume
Xantham.Decoderand never touch the extraction pipeline - Overload support added via
IOverloadable/TsOverloadableConstruct<'T> - Stack-based traversal avoids JS stack overflows