{"id":26519,"library":"ts2fable","title":"ts2fable","description":"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.","status":"active","version":"0.7.1","language":"javascript","source_language":"en","source_url":"https://github.com/fable-compiler/ts2fable","tags":["javascript","fable","fable-compiler","fsharp","F#","TypeScript"],"install":[{"cmd":"npm install ts2fable","lang":"bash","label":"npm"},{"cmd":"yarn add ts2fable","lang":"bash","label":"yarn"},{"cmd":"pnpm add ts2fable","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Used for parsing TypeScript definition files","package":"typescript","optional":false}],"imports":[{"note":"ts2fable is typically installed globally as a CLI tool; local install is possible but not recommended.","wrong":"npm install ts2fable","symbol":"ts2fable","correct":"npm install -g ts2fable"},{"note":"Use npx for execution; piping to a file may cause issues with error handling.","wrong":"ts2fable input.d.ts > output.fs","symbol":"default","correct":"npx ts2fable input.d.ts output.fs"},{"note":"No import needed; the package is used as a CLI tool, not a library.","wrong":"","symbol":"CLI usage","correct":"ts2fable --help"}],"quickstart":{"code":"npx ts2fable https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/master/types/lodash/index.d.ts lodash.fs","lang":"typescript","description":"Generates F# bindings for lodash from its TypeScript definitions using the current version of ts2fable."},"warnings":[{"fix":"Use new CLI arguments; check --help for updated options.","message":"Version 0.7.0 removed the Yargs dependency and changed some command-line options.","severity":"breaking","affected_versions":">=0.7.0"},{"fix":"Regenerate bindings with ts2fable 0.6.0 or later, and update Fable.Core dependency.","message":"Version 0.6.0 introduced Fable.Core 3.0 support, breaking compatibility with Fable.Core 2.x generated bindings.","severity":"breaking","affected_versions":"<=0.5.2"},{"fix":"Use `npx ts2fable` instead of global install.","message":"The global installation via -g is deprecated; prefer using npx to ensure you use the latest version.","severity":"deprecated","affected_versions":">=0.7.0"},{"fix":"Upgrade to 0.7.1 which fixes issue #334.","message":"Error: undefined is not iterable - occurs with some V8 TypeScript definitions.","severity":"gotcha","affected_versions":"0.7.0"},{"fix":"Upgrade to 0.7.0 or later which fixes this naming issue (#299).","message":"Generated F# modules may have incorrect PascalCase naming if the TypeScript module name contains uppercase letters like 'BABYLON'.","severity":"gotcha","affected_versions":"<0.7.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Update to ts2fable 0.7.1 or later.","cause":"Bug in ts2fable 0.7.0 when parsing certain TypeScript files with nested constructs.","error":"Error: undefined is not iterable"},{"fix":"Ensure the input .d.ts file exists and is accessible; use --help to check required arguments.","cause":"Missing required command-line argument or incorrect input file path.","error":"Option has no value"},{"fix":"Run `npm install typescript` in the same directory where ts2fable is installed.","cause":"The typescript peer dependency is not installed.","error":"Cannot find module 'typescript'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}