I see how checking your compiled .js/.bs.js files are important, but why can’t we have built-in template integrations with Next, CRA, ESbuilds, and Expo like Typescript does so that we can write .res files and not have additional .bs.js files?
What problem are you trying to solve?
I don’t believe there is anything built into TypeScript regarding those specific libraries - rather it is the other way around, those libraries have built-in support for TypeScript. You could ask the library authors to support ReScript “natively”, but currently seems unlikely to happen given ReScript is still a niche language.
However, you should know that this probably could be solved using plugins or similar to those libraries. For instance, vite-plugin-rescript enables working with
.res files directly. The
.bs.js files are still generated in the
lib folder, but they are only needed during bundling and can be ignored by git.
Because TypeScript is running on JS, and therefore easier to integrate in JS based toolchains because they get access to TS’ compiler APIs. ReScript has a native toolchain and a restrictive compilation model, so it’s way harder to properly integrate it in any pre-existing JS tooling. Some ppl tried to create plugins that run sub-processes alongside the rest of the tools, but this caused all kinds of race-conditions and weird process states.
I personally like the fact that ReScript has its own process, compiles its own JS files that can be integrated the way I need it. Also, that way we have full control over the performance attributes of the ReScript compiler without other tools interfering with slow subprocesses.
.bs.js files are great.
Most of configs (next, next-i18n) - are using js.
And you can not import anything from ts files, you need to compile it to js first.
With rescript I can store metadata, and than it will be compiled into .bs.js - so it can be imported an any config file that is not json.
For example, I had defined list of languages, and in a config imported it, so now for every language we have we generate sitemap. And since I import the list of languages, there is a single source of truth. No code duplication.