News for hackers. Stuff that matters.
Re:From TypeScript to ReScript by verve_rat on Wednesday January 12, 2022 @07:15AM (#29905318)
If you don't want to use Typescript... then don't?
Re:From TypeScript to ReScript by capableweb on Wednesday January 12, 2022 @08:19AM (#29905966)
Yeah, duh. The argument is that there is a group of people who wants types and write libraries. Before they used JSDoc, which is effortless to use from JS, as it's just actually vanilla JS. Some of those started using TypeScript now for everything, including libraries. If I want to use those libraries, I need to fork the project and rewrite them to vanilla JS, something that was not needed before. Or find a different library/write it myself.
Re:From TypeScript to ReScript by elevader on Wednesday January 12, 2022 @08:28AM (#29906050)
You actually don't, that's the nice part. NPM Typescript modules are shipped as transpiled js modules with d.ts files. Those d.ts files contain the type informations for consuming TS projects but they are completely optional and you can simply ignore them if you write a plain js project.

You can see this in the babel project, for example. It is written in typescript but used by a lot of js projects that don't care (and don't have to care) about this.

Re:From TypeScript to ReScript by smt88 on Wednesday January 12, 2022 @08:33AM (#29906090)
It sounds like you either don't use npm and are trying to use libraries' source files or you don't actually have this issue. This doesn't and can't happen with npm.
Re:From TypeScript to ReScript by mynegation on Wednesday January 12, 2022 @08:37AM (#29906117)
> If I want to use those libraries, I need to fork the project and rewrite them to vanilla JS

Why? If you want to just use, npm packages give you “compiled” vanilla JS and type definition files that you can ignore. Alternatively you can compile them yourself, if you vendor them in.