{"id":13837226,"url":"https://github.com/ocsigen/ts2ocaml","last_synced_at":"2025-04-07T05:12:11.511Z","repository":{"id":37798871,"uuid":"253973245","full_name":"ocsigen/ts2ocaml","owner":"ocsigen","description":"Generate OCaml bindings from TypeScript definitions via the TypeScript compiler API","archived":false,"fork":false,"pushed_at":"2024-05-10T00:32:51.000Z","size":27990,"stargazers_count":162,"open_issues_count":12,"forks_count":6,"subscribers_count":14,"default_branch":"main","last_synced_at":"2024-05-11T00:40:49.618Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"F#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ocsigen.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-04-08T03:14:27.000Z","updated_at":"2024-05-30T03:15:16.320Z","dependencies_parsed_at":"2024-03-04T05:04:12.724Z","dependency_job_id":"d870ebd6-d77b-434e-bd75-2635c3323fcd","html_url":"https://github.com/ocsigen/ts2ocaml","commit_stats":{"total_commits":465,"total_committers":6,"mean_commits":77.5,"dds":0.410752688172043,"last_synced_commit":"e5b23d2a5dd00ca7c0d0c558cde8b07b050e6a35"},"previous_names":[],"tags_count":60,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ocsigen%2Fts2ocaml","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ocsigen%2Fts2ocaml/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ocsigen%2Fts2ocaml/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ocsigen%2Fts2ocaml/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ocsigen","download_url":"https://codeload.github.com/ocsigen/ts2ocaml/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247595335,"owners_count":20963943,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-04T15:01:03.807Z","updated_at":"2025-04-07T05:12:11.481Z","avatar_url":"https://github.com/ocsigen.png","language":"F#","funding_links":[],"categories":["F# #","[🧑‍💻 dev](https://github.com/stars/ketsapiwiq/lists/dev)"],"sub_categories":[],"readme":"ts2ocaml\n========\n\n[![npm latest version](https://img.shields.io/npm/v/@ocsigen/ts2ocaml/latest.svg)](https://www.npmjs.com/package/@ocsigen/ts2ocaml)\n[![npm latest version](https://img.shields.io/npm/v/@ocsigen/ts2ocaml/beta.svg)](https://www.npmjs.com/package/@ocsigen/ts2ocaml)\n\nGenerate OCaml bindings from TypeScript definitions via the TypeScript compiler API.\n\n## Installation\n\n\u003e Try out v2 beta!\n\u003e \n\u003e `npm install -g @ocsigen/ts2ocaml@beta`\n\n```\nnpm install -g @ocsigen/ts2ocaml\n```\n\nOr if you are using yarn:\n\n```\nyarn global add @ocsigen/ts2ocaml\n```\n\nAn in-browser version may be available in future.\n\n## Overview\n\n**Goals:**\n* Provide a way to quickly generate a missing binding to some JS package you need in your project.\n  - This tool can generate OCaml bindings to JS packages from TS definition files (`.d.ts`), which you can use with minimal modification.\n* Help library authors by reducing the amount of boilerplate code they have to write by hand.\n  - This tool can be configured to generate an imperfect but simpler version of bindings, which you can easily modify to create a better binding library.\n\n**Non-goals:**\n* Generate a binding written in 100% OCaml-idiomatic way.\n  - OCaml has very different programming concepts from TypeScript, so it's not very straightforward to translate TypeScript's concepts to OCaml's one.\n  - This tool will simply generate bindings which closely resembles the original TypeScript definitions. It's human's job to translate it to OCaml-idiomatic API.\n* Perfectly replicate TypeScript's type system in OCaml.\n  - Many of [the advanced types in TypeScript](https://www.typescriptlang.org/docs/handbook/2/types-from-types.html), such as `keyof T` or `T extends U ? A : B`, are simply impossible to simulate in OCaml.\n  - In those cases, this tool will leave them as untyped. It's also human's job to (possibly) restore type safety with some other means.\n\n## Documentation\n\nFor users:\n- [Common options](docs/common_options.md) among all the targets\n- [ts2ocaml for js_of_ocaml](docs/js_of_ocaml.md)\n- [ts2ocaml for ReScript](docs/rescript.md)\n\nFor developers and contributors:\n- [Overview for developers](docs/development.md)\n- [Note on modeling TS subtyping in OCaml](docs/modeling_subtyping.md)\n\n## About this tool\n\nThis tool is heavily inspired by [fable-compiler/ts2fable](https://github.com/fable-compiler/ts2fable), which generates [Fable](https://fable.io/) (F# AltJS) bindings from TS definition files.\n\nThis tools is licensed under the [Apache License 2.0](LICENSE.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Focsigen%2Fts2ocaml","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Focsigen%2Fts2ocaml","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Focsigen%2Fts2ocaml/lists"}