All Projects → jsiebern → re-typescript

jsiebern / re-typescript

Licence: other
An opinionated attempt at finally solving typescript interop for ReasonML / OCaml.

Programming Languages

reason
219 projects
ocaml
1615 projects
C++
36643 projects - #6 most used programming language

Projects that are alternatives of or similar to re-typescript

socc
Simple C Compiler in OCaml
Stars: ✭ 41 (-39.71%)
Mutual labels:  menhir, lexer
Jflex
The fast scanner generator for Java™ with full Unicode support
Stars: ✭ 380 (+458.82%)
Mutual labels:  parsing, lexer
bs-decode
Type-safe JSON decoding for ReasonML and OCaml
Stars: ✭ 105 (+54.41%)
Mutual labels:  decoding, reasonml
Bs Material Ui
ReScript bindings for material-ui
Stars: ✭ 185 (+172.06%)
Mutual labels:  reasonml, reason-react
Chevrotain
Parser Building Toolkit for JavaScript
Stars: ✭ 1,795 (+2539.71%)
Mutual labels:  parsing, lexer
Rescript Relay
Use Relay with ReasonML.
Stars: ✭ 214 (+214.71%)
Mutual labels:  reasonml, reason-react
Serpent
A protocol to serialize Swift structs and classes for encoding and decoding.
Stars: ✭ 281 (+313.24%)
Mutual labels:  parsing, decoding
Reroute
a fast, declarative microrouter for reason-react
Stars: ✭ 120 (+76.47%)
Mutual labels:  reasonml, reason-react
Graphql Go Tools
Tools to write high performance GraphQL applications using Go/Golang.
Stars: ✭ 96 (+41.18%)
Mutual labels:  parsing, lexer
Logos
Create ridiculously fast Lexers
Stars: ✭ 1,001 (+1372.06%)
Mutual labels:  parsing, lexer
Fullstack Reason
A demo project that shows a fullstack ReasonML/OCaml app–native binary + webapp
Stars: ✭ 164 (+141.18%)
Mutual labels:  reasonml, reason-react
re-use
⚛️ 🎣 A collection of hooks for ReasonReact
Stars: ✭ 27 (-60.29%)
Mutual labels:  reasonml, reason-react
Pure
React in pure Reason that targets native platforms.
Stars: ✭ 135 (+98.53%)
Mutual labels:  reasonml, reason-react
Reason Graphql Fullstack
Fullstack Reason + GraphQL Todo List App
Stars: ✭ 246 (+261.76%)
Mutual labels:  reasonml, reason-react
Brisk Reconciler
React.js-like reconciler implemented in OCaml/Reason
Stars: ✭ 124 (+82.35%)
Mutual labels:  reasonml, reason-react
sb-dynlex
Configurable lexer for PHP featuring a fluid API.
Stars: ✭ 27 (-60.29%)
Mutual labels:  parsing, lexer
Reason Calculator
A calculator built with Reason and reason-react.
Stars: ✭ 110 (+61.76%)
Mutual labels:  reasonml, reason-react
Rescript Recoil
Zero-cost bindings to Facebook's Recoil library
Stars: ✭ 115 (+69.12%)
Mutual labels:  reasonml, reason-react
Tox
misc parsers in rust
Stars: ✭ 40 (-41.18%)
Mutual labels:  parsing, lexer
app-template-rescript-react
Adding ReScript with rescript-react on top of @snowpack/app-template-react
Stars: ✭ 44 (-35.29%)
Mutual labels:  reasonml, reason-react

re-typescript

An opinionated attempt at finally solving typescript interop for ReasonML / OCaml.

Why

I am maintaining a package of automatically generated bindings for Material UI. Generating these bindings is becoming more and more frustrating, as the complexity of the original package grows and tools that wish to cover everything begin to break down. this leads to more and more types missing on each cycle and precious time spent on recovering them by adjusting the type extraction process. Right now the generator uses a library which converts typescript into a json-schema which then get's analyzed & parsed into reason code. I believe that these tools want to cover too many use cases in order to be effective. So I'm setting out to simplify this process and maybe provide an effective way of generalizing type mapping between reason and typescript.

Quite ambitious. We'll see.

Idea

re-typescript implements it's own lexer / parser to analyse typescript declaration files specifically. It purposefully does not want to get into tracking inferred types through *.ts files. It only extracts cleanly defined types as best as it can.

I am not sure about how to handle unparseable code yet. I believe a best approximation appraoch will be best, where it will gracefully end the traversal by just injecting an abstract type of some sort, instead of failing or fully omitting a type.

re-typescript first derives a primitive AST from the tokenization process. It then decodes that AST by way of resolving references / dependencies. Finally it directly generates an ocaml AST, which allows for easy printing of both reason & ocaml. I'm composing the ast by using ocaml-migrate-parsetree, which will later allow for an easy use inside of a potential PPX.

This tool will be opinionated about a few things. Typescripts dynamic nature makes this unavoidable. I am not yet sure how the native mode will generate it's types exactly (esp. regarding unions / mixed enums). Bucklescript has great features for handling these things, like the @unboxed attribute, as well as @bs.string for externals and bs.as in records.

Playground

I will update the playground from time to time. It's not great yet, I just wanted a visual representation for now. You can see the current progress here: re-typescript

Roadmap

See projects section: re-typescript projects

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].