Registry / serialization / ts2fable

ts2fable

JSON →
library0.7.1jsnpmunverified

A TypeScript definition file parser for the Fable compiler, converting TypeScript type definitions (.d.ts) into F# (.fs) files for use in Fable projects. Current stable version is 0.7.1, with releases on a quarterly to biannual cadence. It handles TypeScript modules, types, and interfaces, generating idiomatic F# bindings with support for generics, callbacks, and unions. Key differentiators: integrates with Fable's type system, supports modern TypeScript features, and includes a command-line interface for batch processing.

npm install ts2fable
INSTALL
IMPORT
SIG · TS2FABLE
T
ts2fable
serializationjavascriptv0.7.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

ts2fable
✓ npm install -g ts2fable
✗ npm install ts2fable
ts2fable is typically installed globally as a CLI tool; local install is possible but not recommended.
default
✓ npx ts2fable input.d.ts output.fs
✗ ts2fable input.d.ts > output.fs
Use npx for execution; piping to a file may cause issues with error handling.
CLI usage
✓ ts2fable --help
No import needed; the package is used as a CLI tool, not a library.

Generates F# bindings for lodash from its TypeScript definitions using the current version of ts2fable.

npx ts2fable https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/master/types/lodash/index.d.ts lodash.fs
ts2fable --version
Debug
Known issues
breakingVersion 0.7.0 removed the Yargs dependency and changed some command-line options.
fix
Use new CLI arguments; check --help for updated options.
affects: >=0.7.0
breakingVersion 0.6.0 introduced Fable.Core 3.0 support, breaking compatibility with Fable.Core 2.x generated bindings.
fix
Regenerate bindings with ts2fable 0.6.0 or later, and update Fable.Core dependency.
affects: <=0.5.2
deprecatedThe global installation via -g is deprecated; prefer using npx to ensure you use the latest version.
fix
Use `npx ts2fable` instead of global install.
affects: >=0.7.0
gotchaError: undefined is not iterable - occurs with some V8 TypeScript definitions.
fix
Upgrade to 0.7.1 which fixes issue #334.
affects: 0.7.0
gotchaGenerated F# modules may have incorrect PascalCase naming if the TypeScript module name contains uppercase letters like 'BABYLON'.
fix
Upgrade to 0.7.0 or later which fixes this naming issue (#299).
affects: <0.7.0
Errors
Common errors & fixes
Error: undefined is not iterable
Bug in ts2fable 0.7.0 when parsing certain TypeScript files with nested constructs.
fix
Update to ts2fable 0.7.1 or later.
Option has no value
Missing required command-line argument or incorrect input file path.
fix
Ensure the input .d.ts file exists and is accessible; use --help to check required arguments.
Cannot find module 'typescript'
The typescript peer dependency is not installed.
fix
Run `npm install typescript` in the same directory where ts2fable is installed.
Upgrade
Version history
0.7.1latest on npm
Audit
Dependencies
typescriptrequiredUsed for parsing TypeScript definition files
Agent activity
13 hits · last 30 days
node
12
OpenAI (training)
1
Resources
ts2fable — npm install ts2fable · libregistry