BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News ReScript 12.0 Released with New Build System

ReScript 12.0 Released with New Build System

Listen to this article -  0:00

ReScript, the robustly typed language that compiles to JavaScript, has released ReScript 12.0, completing a multi-year development roadmap to modernize the compiler toolchain and deliver a better developer experience with improved syntax and performance.

ReScript 12.0 introduces several major features, including a completely rewritten build system, improved operators, dictionary literals with pattern matching, nested record types, JSX preserve mode, and regex literals. The release also brings a modular runtime architecture and platform-specific binaries that significantly reduce installation footprint.

One of the headline features in ReScript 12 is the new build system, introduced earlier in November, which brings intelligent dependency tracking and faster incremental builds. The system now tracks dependencies more precisely, avoids unnecessary recompilations, and integrates with incremental workflows even across monorepo packages. This addresses limitations that became apparent as projects grew larger and monorepos became more common, as the previous build system worked primarily on single package projects.

For projects that need to use the old ‘legacy’ build system, the rescript-legacy command can be used for build, build -w and clean commands. It is expected that this will be removed in v13.

ReScript 12 finalizes the unified operator work introduced earlier this year. Arithmetic operators such as +, -, *, /, % and ** now work consistently for int, float, and bigint, allowing the compiler to infer the correct specialization from the left operand. Developers can now use + for string concatenation as well, eliminating the need for the legacy +., -., *., and /. operators that were previously required for floating-point operations.

ReScript 12 also supports dictionary literals that compile to plain JavaScript objects, drastically reducing boilerplate compared to Dict.fromArray. Pattern matching also understands dictionaries, enabling concise destructuring of JSON payloads and configuration objects:

let user = dict{"firstname": "John", "role": "manager"}

switch user {
| dict{"name": name, "role": role} => Console.log2(name, role)
| _ => Console.log("missing user metadata")
}

Developers can enable preserve mode for JSX via "jsx": { "version": 4, "preserve": true }. The compiler will emit JSX syntax instead of transforming elements to react/jsx-runtime calls, this is useful for bundlers such as ESBuild, SWC, or Babel, so they can apply their own transforms. This maintains compatibility with React Compiler and keeps JSX readable in the output.

Teams upgrading from ReScript 11 should review the migration guide and schedule time for the transition. The release includes several breaking changes, most notably the removal of JSX v3 support, a new runtime package structure with @rescript/runtime replacing the previous setup, and API naming changes where functions previously ending with Exn now end with OrThrow. The migration tool includes a codemod that can perform mechanical renames to ease the transition.

Installation footprints have shrunk due to changes in platform-specific packages such as @rescript/darwin-arm64, @rescript/linux-x64, and @rescript/win32-x64. npm will only install the binary that matches the operating system and architecture, resulting in faster installs and smaller cache footprints for CI pipelines.

While specific community discussion around the ReScript 12 release has been limited, the language continues to position itself as an alternative to TypeScript with stronger type guarantees. On reddit, a user commented that the release is quite good news, as they thought the project was dead. Others asked why ReScript should be considered over TypeScript, with one commenter offering some comparison:

TS still has all the bad parts from javascript, and is by design unsound. Its also built in ocaml, so you will probably get one of the fastest compilers out there. No more waiting 5min for a production build.

An older comparison between the two highlight that ReScript's type system is sound and guaranteed to never be wrong, whereas TypeScript's type system makes educated guesses that can sometimes be incorrect at runtime. ReScript also compiles significantly faster than TypeScript, though TypeScript maintains broader ecosystem adoption and JavaScript interoperability.

ReScript is an open-source programming language that compiles to efficient and human-readable JavaScript. Originally derived from OCaml, it has evolved into a distinct language with its own syntax and toolchain. ReScript is particularly popular in React development, offering first-class JSX support and a lightning-fast compiler that scales to any codebase size.

About the Author

Rate this Article

Adoption
Style

BT