1.4.6 • Published 10 months ago
@ocsigen/ts2ocaml v1.4.6
ts2ocaml
Generate OCaml bindings from TypeScript definitions via the TypeScript compiler API.
Installation
npm install -g @ocsigen/ts2ocaml
Or if you are using yarn:
yarn global add @ocsigen/ts2ocaml
An in-browser version may be available in future.
Overview
Goals:
- Provide a way to quickly generate a missing binding to some JS package you need in your project.
- This tool can generate OCaml bindings to JS packages from TS definition files (
.d.ts
), which you can use with minimal modification.
- This tool can generate OCaml bindings to JS packages from TS definition files (
- Help library authors by reducing the amount of boilerplate code they have to write by hand.
- 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.
Non-goals:
- Generate a binding written in 100% OCaml-idiomatic way.
- OCaml has very different programming concepts from TypeScript, so it's not very straightforward to translate TypeScript's concepts to OCaml's one.
- 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.
- Perfectly replicate TypeScript's type system in OCaml.
- Many of the advanced types in TypeScript, such as
keyof T
orT extends U ? A : B
, are simply impossible to simulate in OCaml. - 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.
- Many of the advanced types in TypeScript, such as
Documentation
For users:
- Common options among all the targets
- ts2ocaml for js_of_ocaml
- ts2ocaml for ReScript (ongoing)
For developers and contributors:
About this tool
This tool is heavily inspired by fable-compiler/ts2fable, which generates Fable (F# AltJS) bindings from TS definition files.
This tools is licensed under the Apache License 2.0.
2.0.0-beta.3
10 months ago
2.0.0-beta.2
10 months ago
2.0.0-beta.1
10 months ago
2.0.0-beta.0
10 months ago
1.4.6
1 year ago
1.4.5
1 year ago
2.0.0-alpha.0
1 year ago
1.4.4
3 years ago
1.4.3
3 years ago
1.4.2
3 years ago
1.4.1
3 years ago
1.4.0
3 years ago
1.4.0-beta.6
3 years ago
1.4.0-beta.5
3 years ago
1.4.0-beta.4
3 years ago
1.4.0-beta.3
3 years ago
1.4.0-beta.2
3 years ago
1.4.0-beta.1
3 years ago
1.4.0-beta.0
3 years ago
1.2.0
3 years ago
1.1.0
3 years ago
1.0.0
3 years ago
1.3.1
3 years ago
1.3.0
3 years ago
1.2.1
3 years ago
0.0.5
3 years ago
0.0.3
3 years ago
0.0.2
3 years ago
0.0.1-1
3 years ago
0.0.1-0
3 years ago