Here are some scenarios, I’m pretty sure we’re in none of them. I don’t know how plausible any of them are:
-
You can imagine some fantasy version of Rescript that looks at
.d.ts
files and uses them to power interop. I realize there is not a 1:1 mapping from TS types to Rescript types. -
You can also imagine some fantasy world where maybe there’s some codegen that does a pretty good job of making a Rescript declaration from a TS declaration, and then I can touch that up.
-
Or you can imagine a hell world where maybe a lot of the time it’s just not possible to bind a JS module to Rescript types properly.
I’ve studied the documentation on JS Interop starting here quite a bit but still don’t feel clear.
In general when it comes to TS interop, the sense I get is that there’s some codegen stuff people made for generating types, and that stuff is natively supported as of BS 5. But even the documentation on gentype is out-of-the-way and in some places just plain wrong (keeps referring to me needing to compile gentype or something, when I don’t).
It’s not clear to me if I should expect anything similar for the other direction of Rescript <> TS interop, and whether that’s a priority, or what. It’s not clear to me if we’ve made great progress on a Rescript version of DefinitelyTyped.
To me declarations feel like a big constraint on interop right now. Even having PropTypes integration would be nice.
This post is getting a little rambly. To summarize:
- What is the state of inference or declaration codegen when binding to JS modules?
- What should I expect in the future? What are the priorities and technical possibilities?
- What is the state of easy-to-install bindings/declarations for popular JS modules?