Diullei/ts2reason

How can I help?

Closed this issue · 5 comments

idkjs commented

If you tell me what to do, I will do it. Been doing this manually.

Hello, thank you for your interest in helping! This project has a long way to go and the implementation I'm writing for now is following a fairly experimental approach.

I started the project with a simple code written in TypeScript (see the main.ts file). From there I started to convert part of the code to ReasonML. The code in TypeScript was using the project https://github.com/dsherret/ts-simple-ast but the version in Reason is using the API exposed by the TypeScript compiler. My intention here is not to port the entire typescript code from mains.ts to reasonml, but instead, the idea is to follow the TypeScript grammar to write the implementation (the main.ts code was just a PoC).

I'm using the TypeScript grammar from https://github.com/Microsoft/TypeScript/blob/master/doc/spec.md#A as a guide to create the conversion spec (see here spec.md). The implementation for the spec.md can be found here: '__tests __/MainTest.re'.

The project structure:

  • Writer.re - This module contains functions to be used to write the reasonml code (see the WriterTest.re for more details).
  • tsApiBridge.ts - This module intends to be a facade to access the TypeScript API. The code in this file contains a visitor function that needs to be expanded to inspect the TypEscript AST nodes. The result of this module will be a collection of TsNode objects.
  • TsApi.re - This module contains the interop between the typescript API (the tsApiBridge.ts) and the reasonml code (see the TsApiTest.re file).

...to help you can:

  • Do coding review :) This is my first experience with ReasonML, so feel free to suggest changes to the code and to the project if you find something that is not language oriented.
  • Edit the spec.md file suggesting possible alternatives to implement the TypeScript -> ReasonML conversion. You said you've been doing it manually, so you may have good ideas about how to write the bindings. We need to find a way to convert these ideas into an automated process.
  • Setup a continuous integration on Travis-ci.
  • Write code! Now that you know about the project structure you can try to implement something.

As the project is getting scope we will be able to better-define tasks and build a roadmap/backlog. Please, feel free to ask anything that still not clear ;)

idkjs commented

Thanks for that. I thought I would share some other projects you may be aware of, in case you were not. These have helped me out along the way while trying to decipher some typescript which I do not really know.

https://github.com/cristianoc/genType
https://github.com/rrdelaney/reason-dre
https://github.com/rrdelaney/ReasonablyTyped

Hey, thank you for share. I saw that projects. The genType project seems to be a very helpful project, even though it is not able to create reasonml bindings from typescript definitions, (at least not yet). About ReasonablyTyped and reason-dre, both projects seem to not be active for some months. It seems that the activities on ReasonablyTyped stopped in favor of the reason-dre project.

idkjs commented

Agreed on Reason-dre but there is still so much good code you can use in those projects. Lots of good ideas. I used reason-dre to create some binding the other day Its a bit of a slog, kinda have to think through the errors, but they worked. It can definitely be used as a starting point. Don't sleep on that one.

Good, thank you, I'll take a look at the ideas behind that projects. I'll close this issue for now. If there is something more I can explain about the project, please, just reopen this issue.