ReScript — The cousin of TypeScript

What is Rescript?

Typically TypeScript transpiles into unreadable code but the auto-generated js file from ReScript is very concise & readable. The speed of transpilation and the performance of such code is surprising. If the ReScript code compiled, it means its types are safe and sound, so it can optimize away all the noises.


npm install -g bs-platform

New Project

git clone
cd rescript-project-template
npm install
npm run build
node src/

That compiles your ReScript into JavaScript, then uses NodeJS to run said JavaScript. We recommend you use our unique workflow of keeping a tab open for the generated .bs.js file, so that you can learn how ReScript transforms into JavaScript.

Existing Project

Install ReScript locally as a devDependency:

npm install --save-dev bs-platform

Create a ReScript build configuration at the root:

"name": "your-project-name",
"sources": [
"dir": "src", // update this to wherever you're putting ReScript files
"subdirs": true
"package-specs": [
"module": "es6",
"in-source": true
"suffix": ".bs.js",
"bs-dependencies": []

Add convenience npm scripts to package.json:

"scripts": {   "re:build": "bsb -make-world -clean-world",   "re:start": "bsb -make-world -clean-world -w" }

Since ReScript compiles to clean readable JS files, the rest of your existing toolchain (e.g. Babel and Webpack) should just work!


  1. Function- and module-level dead code elimination is facilitated by the well-engineered type system and purity analysis.
  2. At the global level, ReScript generates code that is naturally friendly to dead code elimination done by bundling tools such as Rollup and Closure Compiler, after its own sophisticated elimination pass.
  3. The same dead code elimination logic applies for ReScript’s own tiny runtime which is written in ReScript itself
  4. A very tiny JS output . A Hello world ReScript program generates 20 bytes of JS code
  5. The standard libraries required are only included when needed.
  6. It has the fastest iteration loop timings. ReScript’s build time is one or two orders of magnitude faster than any alternatives.
  7. ReScript’s JS output is very readable. This is especially important while learning, where users might want to understand how the code’s compiled, and to audit for bugs.
  8. The readability characteristic, combined with a fully-featured JS interop system, allows ReScript code to be inserted into an existing JavaScript codebase almost unnoticed.

Difference with TypeScript

  1. TypeScript covers the entire JavaScript feature set and more but ReScript covers only a curated subset of JavaScript.
  2. ReScript code has no null/undefined errors.
  3. ReScript is extremely fast due to its simplicity and curation. It’s one of the fastest compiler & build system toolchains for JavaScript development.
  4. Doesn’t need type annotations. The types are inferred by the language & highly correct.
  5. Migrating to TypeScript is done breadth-first whereas migrating to ReScript is done depth-first.


ReScript, as with other statically typed functional languages, aims at changing the way code is approached at a fundamental level.

We have already adopted a “functional style” in the ecosystem with map, filter, reduce functions in JavaScript. ReScript represent the next — hybrid stage — of a properly functional language from the ML family which compiles to the industry’s standard JavaScript.

GitHub :

Official Page :

You should also look at ELM.

Software Architect / Writer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store