ReScript is one of several emerging programming languages that helps web developers build complex web applications that can be transpiled into JavaScript and run in the browser.
JavaScript usage has changed drastically over the past 25 years. However, while the language continues to evolve, it struggles to deliver the capabilities required for the complex applications that are being developed these days.
Languages like ReScript and TypeScript fill in the gaps that exist in JavaScript and help developers build more robust applications that can still run in the browser through JavaScript transpilation.
TypeScript quickly became the dominant player in the field by offering a convenient migration path from JavaScript that relies on the fact that TypeScript is a superset of JavaScript, meaning that code written in JavaScript is a valid TypeScript code - making the migration process as easy as renaming a file. Developers can slowly add TypeScript specific features (such as type definitions) without requiring a complete rewrite of the application.
ReScript, on the other hand, only covers a subset of JavaScript, which enables it to keep a lean syntax that is easy to learn and is instrumental in helping developers avoid many of the pitfalls that JavaScript (and, therefore, TypeScript) includes.
This means that migrating to ReScript is more challenging. Still, ReScript code is generally easier to read and maintain, generates optimized, readable JavaScript code, and provides a blazingly fast compiler that is taught to be one or two orders of magnitude faster than alternatives.
The easiest way to start using ReScript is the online playground that allows developers to experiment with ReScript without going through a local installation.
To set up a new ReScript project, developers are advised to clone the official template project, install the dependencies and the build script:
git clone https://github.com/rescript-lang/rescript-project-template
cd rescript-project-template
npm install
npm run build
node src/Demo.bs.js
It's also possible to add ReScript to an existing project by following a short guide.
Finally, ReScript ships with built-in support for JSX and ReactJS that can easily be installed using the following guide
ReScript is available via the Github repository and is released under the MIT license. Developers are encouraged to contribute and provide feedback to the project by following the contribution guidelines, and the code of conduct.