Live data from Hacker News

I Switched from TypeScript to ReScript

medium.com

41–49 of 49 posts

Re: I Switched from TypeScript to ReScript

#41
post #4

I was using TypeScript all through 2019. Went back to plain old JavaScript at the beginning of 2020. Still using plain old JavaScript by default, and break out React when I _really_ have to. No regrets, many benefits.

People here are forgetting that Typescript is first and foremost a static code analysis tool for Javascript. You can run Typescript's compiler WITHOUT writing a single type declaration as part of your CI, and you should. You don't have to write a single .ts file to use Typescript.

Re: I Switched from TypeScript to ReScript

#42

Earlier quoted context omitted.

typescript is liteally a superset of js. what are your benefits

I'm not op, but here's my opinion: I'm willing to accept the basic hypothesis that's static typing makes for less runtime errors. The type system in well thought out languages like elm or rust makes coding in them pretty simple. I don't think that typescript's type system is good enough to actually deliver on this promise. It's very easy, in my experience, to spend 5 minutes writing a function that I am 100% sure wil…

[deleted]

Re: I Switched from TypeScript to ReScript

#43

I think the best point in the article is this: > ReScript, as with other statically typed functional languages, aims at changing the way code is approached at a fundamental level. We currently have a project written in ReScript and it's an absolute nightmare. Most of our stack is JavaScript/TypeScript/Flow, so no one can just jump in and work on it very easily - they first have to learn ReScript and all of it's diffe…

I help maintain ReScript. That it _seems_ to change the way code is approached is an artifact of an early community excited to try FP concepts in it. Nothing wrong with that; however, the ReScript team (me included) don't really approach things this way. Our goal, outlined at (https://rescript-lang.org/docs/manual/latest/introduction), is to provide:

- a more solid type system - and a much faster compilation speed (a growing pain in TS projects) - to write mainstream code - for products (as opposed to a focus on intermediate FP libraries)

The fact that it leverages some FP concepts here and there is just a mean, not the end.

The marketing of this is really hard, because FP usually attracts the crowd you'd expect, at the expense of several of the above emphasis. But we're still working toward it.

Having seen some ReScript codebases in the wild, I definitely know where your team comes from. We do try to approach it with the "different TypeScript" angle, but understandably userland doesn't always write code the way we'd like to recommend.

In the spirit of https://news.ycombinator.com/item?id=25846479, we’re trying to become a boring technology. Unfortunately boring technology had to have gone through a hype period.

Re: I Switched from TypeScript to ReScript

#44
post #15

Earlier quoted context omitted.

A couple of years ago I was a big advocate of ReasonML and went so far as to run a meet up. I honestly believed in the technical value of it and saw it as a better alternative to Typescript. At the time, the waters were muddy enough with Reason, Bucklescript and OCaml but you could explain it away. The rebrand and change of syntax that came with Rescript was the end of the line for me. Issues like async await have go…

Tablecloth uses Belt for JS targets

That sentence makes no sense to me as someone who’s never used Reason/ReScript.

Re: I Switched from TypeScript to ReScript

#45
post #6

> ReScript is not just a rebranding: it’s a ReasonML which freed itself of the yoke of the OCaml ecosystem. By doing so, it forfeited compilation to native code and OCaml library interop, but gained a freer syntax which further resembles JavaScript See also BuckleScript & Reason are now called ReScript : https://rescript-lang.org/bucklescript-rebranding

I find the dropping of native compilation to be unfortunate.

There are 3 categories of code I’m interested in writing:

  - Client code, must compile to JS.
  - Server code, ideally would compile to native.
  - Tooling code (e.g. Webpack / Babel replacements), ideally would compile to native.
I would like to write these things in one language.

ReasonML could do this, ReScript cannot.

Re: I Switched from TypeScript to ReScript

#46

> Simply renaming the file extension won’t work, as the compiler stops completely at type errors. Why did the author think that this would work exactly?

That's how it is with TypeScript, CoffeeScript, SCSS...

This works which most language supersets. My point was that it was a trial and error way of discovering that this was not so.

Seeing it as a separate language, I agree that the statement doesn't really makes sense.

Re: I Switched from TypeScript to ReScript

#47

I'm actually a fan of JavaScript. Even though TypeScript/ReScript might add some cool features, I don't feel the urge to switch...

My interest in ReScript is that it doesn't aim to add more features to JavaScript, it's a completely different language which has a JavaScript-like interface and compiles to JavaScript.

It's a statically-typed functional language from the ML family, which is a huge deal. It implements a completely different approach to code, even if it looks similar.

It's currently academical, "ivory tower," but in my opinion it will trickle into industry. Someone described ReScript as ECMAScript 2030.

Re: I Switched from TypeScript to ReScript

#48
post #26

Earlier quoted context omitted.

Ok well that is true and may happen sometimes. Personally, I have just dabbled with type definitions, configs etc much more than I ever had those kinds of problems in javascript. I just feel typescript usually gets in the way, sometimes in a good way, but all too often in a bad way. Plus my main gripe with typescript is that microsoft owns and controls it so I won't use it just because of that.

Recently I think Microsoft is a very good open source supporter. So it isn't a problem for me. I also feel Typescript is good, but sometimes it is hard to use because of so many typing. It needs VScode always for auto complete helper. I remember javascript as an old good days...

Well I don't care so much about Microsoft per say, but I try to avoid any tech from any big tech company. I don't like their dominance so I'll rather use alternatives.

Re: I Switched from TypeScript to ReScript

#49

Earlier quoted context omitted.

Ok well that is true and may happen sometimes. Personally, I have just dabbled with type definitions, configs etc much more than I ever had those kinds of problems in javascript. I just feel typescript usually gets in the way, sometimes in a good way, but all too often in a bad way. Plus my main gripe with typescript is that microsoft owns and controls it so I won't use it just because of that.

I made this discovery just yesterday. I tried converting a tiny side project from vanilla JS to Typescript because I wanted to see what all the hype was about. I had this idea in my head(perhaps naively) that I would catch an edge case/silent error or two in my application that I did not know existed prior to implementing static typing. Instead, I spent a whole bunch of time wrestling with the tooling and configs in…

It's probably useful, like most stuff that comes out from big companies, if you are a big company with big teams. I do not work for a big company and I will probably never do it again so Typescript is definitely not for me.

People go in this trap again and again, including myself.

"Oh this FAANG uses this, it must be great and suitible for us" - no, it's suitible for them because they have completely different problems than you and have to do stuff in a much more complicated way than you need to.

Post reply on HN