Skip to content
This repository was archived by the owner on Nov 13, 2023. It is now read-only.

Create Bindings from typescript definitions #574

Closed
searleser97 opened this issue Aug 24, 2021 · 8 comments
Closed

Create Bindings from typescript definitions #574

searleser97 opened this issue Aug 24, 2021 · 8 comments

Comments

@searleser97
Copy link

It would be amazing if this library also works the other way around. Right now it can create typescript definitions from rescript code but not the other way around. A feature like this one will allow us to quickly reuse libraries with typescript bindings (there are a lot of them).

@alarbada
Copy link

Related work would be the ts2fable project, but I don't know how hard would be to implement that.

In my experience with it was not that great, it needed a lot of tweaking with the transpiled result. I don't know how well do ts idioms translate to rescript though.

@kevinbarabash
Copy link

This would also be helpful when converting large projects from TypeScript to ReScript. An interesting edge case is creating binding from TypeScript code that itself uses generated bindings from ReScript code. In these situations, we'd GenType to recognize this and use the original ReScript types in the generated bindings instead of generating new ReScript types from the TypeScript types.

@kevinbarabash
Copy link

I found ReasonablyTyped which looks promising. It doesn't appear to be maintained anymore, but it could serve as a good starting point.

@kevinbarabash
Copy link

I didn't realize this project was written in OCaml and not BuckleScript. The approach ReasonablyTyped takes won't work since it interfaces directly with TypeScript's node API. It probably makes sense to have the reverse direction be a separate tool.

@cristianoc
Copy link
Collaborator

For that direction, there's a separate tool that's making rapid progress: ocsigen/ts2ocaml#32.

@3xau1o
Copy link

3xau1o commented Jun 27, 2022

this looks good

@listepo
Copy link

listepo commented Sep 5, 2023

Hey @cristianoc I think you need to create your own alternative for DefinitelyTyped with ocsigen/ts2ocaml#32. What do you think? I think this is the main reason why it is difficult to compete with the Typescript

@ryyppy
Copy link
Member

ryyppy commented Nov 13, 2023

This repository is being archived. If you feel like the issue still relevant, please re-create it in the compiler repo. Thanks!

@ryyppy ryyppy closed this as completed Nov 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants