Rescript launched around 2020 as since then has been called ‘Javascript from the future’, by compiling to JavaScript while offering a fixed set of syntactic, semantic and logical improvements to the language, notable features like Hindley-Milner type system, type metadata conservation, pattern matching, pipe operator, if/else as expressions, automatic currying, decorators, and embedded JSX make the language interesting at first sight, however months after finding it, i can offer a different perspective about which may be another “Javascript from the future” and may has always been.
I recognize Rescript as a Javascript from the future, in the sense it has features missing from the Javascript of the present, however Javascript from the future may become more feature parity with Rescript, here’s a listing of some relevant ECMAScript proposals:
Rescript already has those features, but also has some limitations, the dominant language for web development i believe it’s typescript, even if some people still use plain javascript, the general direction is moving towards typed web development (hope this is obvious), and Typescript is now like a Defacto unofficial standard, there is even an ECMAScript proposal for bringing types to JavaScript
- ES Type Annotations | Stage 1
Currently you can consume Rescript from Typescript using a tool called GenType, however you can only consume Rescript from Typescript but not Typescript from Rescript, which forces you to develop and maintain custom bindings, which make Rescript not as viable option for long term projects using 3rd party libraries from the typescript ecosystem
If you prefer the standard Typescript ecosystem, then you are already have a “Javascript from the future”, which supported many ECMAScript features before they reached mainstream, like classes, optional chaining and null coalescing operator, or features on the road like decorators and type annotations.
Basically, typescript more than a “Javascript OTF” is like an evolving futurist ECMAScript guinea pig.
Rescript will follow its own path of perfectionism, where Typescript will not fit, those who are brave and discontented with the status quo can always join efforts in any side, thanks to the Rescript team for an awesome language, the future of Rescript, I believe, depends heavily on the community, can’t wait for it.
~ A fellow