Glutinum 1.0 is out. It turns the TypeScript declarations of a JavaScript package into an F# binding.
Fable, the compiler that turns F# into JavaScript, compiles your code against that binding, and the JavaScript library runs unchanged.
Generate a binding
Install the package you want to use, then point Glutinum at it:
npm install chalk
npx @glutinum/cli chalk --out-file Glutinum.Chalk.fs
The result is a single .fs file that you add to your Fable project. Every binding needs Glutinum.Types. Add Glutinum.Web or Glutinum.Node when the package uses browser or Node.js types:
dotnet add package Glutinum.Types
dotnet add package Glutinum.Web # optional
dotnet add package Glutinum.Node # optional
Then use the library from F#:
open Glutinum.Chalk
printfn "%s" (chalk.red "Hello")
The input can be an installed package (chalk, @types/vscode), a subpath (date-fns/locale), a package directory, or a .d.ts file. You can also paste a declaration into the web app and see the F# right away.
What 1.0 changes
Glutinum went through 14 betas between September and October 2026. The betas fixed the TypeScript constructs found by compiling real bindings, among them msal-browser, sortablejs and i18next. The test suite has 588 TypeScript declarations, each with its expected F# output.
Object types have a Create member
This change breaks existing code. Each TypeScript object type becomes one F# interface. It keeps its extends chain, and you can inherit from it, including from another binding. You build the object with a static Create:
// 0.x
JsonWebKey(alg = "x")
// 1.0
JsonWebKey.Create(alg = "x")
Inline object types in a method signature get the same treatment. This TypeScript:
interface Locale {
hello(config: {
verbose: Boolean
}): string;
}
becomes:
[<AllowNullLiteral>]
[<Interface>]
type Locale =
abstract member hello: config: Locale.hello.config -> string
module Locale =
module hello =
[<AllowNullLiteral>]
[<Interface>]
type config =
abstract member verbose: bool with get, set
[<ParamObject; Emit("$0")>]
static member Create (verbose: bool) : config = nativeOnly
More TypeScript is resolved
Glutinum runs on TypeScript 6 and uses the TypeScript checker to resolve Omit, Pick and conditional types. Module names follow the package's subpaths and its exports map.
New CLI options
--globalbinds the globals that a script declares.--max-overloadscaps the overloads a signature gets from its union parameters. The default is 16.
Upgrade from 0.14
No CLI option was removed. Regenerate your bindings, then:
- Replace constructor calls on object types with
.Create(...). - Fix the call sites that relied on delegates or on unions that are now erased.
- Add
Glutinum.Typesto your project if it is not there yet.
What Glutinum cannot do
Some TypeScript types have no F# equivalent. Glutinum generates obj for them rather than failing:
- Conditional types whose result depends on a caller's type parameter.
T[K]andkeyof TwhenTis not known.any,unknown,symbolandnever.
Constraints on type parameters (<T extends Node> becomes <'T>) and this parameters are dropped. When the generated code is not enough, use unbox, !! or createObj, or extend the binding by hand. The limitations page has the full list.
Links
- Documentation: glutinum.net
- Web app: glutinum.net/app
- Changelog: CHANGELOG.md
If you find a bug, paste the declaration into the web app and cut it down to the smallest one that still shows the problem. Then open an issue with it.
Thanks to everyone who contributed code or reported issues: @joprice, @NatElkins, @jkone27, @houstonhaynes, @roboz0r, @nojaf, @shayanhabibi, @goswinr, @spatialfree, @kevkov, @baronfel and @0xLiao.