Live data from Hacker News

I Switched from TypeScript to ReScript

medium.com

21–30 of 49 posts

Re: I Switched from TypeScript to ReScript

#21
post #20

Earlier quoted context omitted.

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

The biggest practical benefits of plain JS over TS are that: * code is terser * the JS standard is more stable/standardised * code can be distributed uncompiled * code has broader tooling support * code can be reasoned about and debugged directly and natively in web browsers without the need for sourcemaps/plugins/etc. * file sizes are generally smaller * there are fewer config files * there are fewer moving parts an…

* no compile time

I've been using vanilla JS when not using Reason and it is pretty nice. I hate that safari does not support arrow function methods though (as they allow you to not have to bind `this` in the constructor).

concerning you post scriptum in brackets, what I like with types is:

1. refactoring becomes simpler 2. understanding APIs becomes simpler

Re: I Switched from TypeScript to ReScript

#22
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.

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 will work fine in JavaScript, and then spend 15 minutes trying to figure out how to type it. I'm sure that this is partly due to my own lack of understanding. Typing is basically a huge add-on to the cognitive load when using this superset.

Of course, it could just be that I'm not very good at typescript. But it's a new technology, and it's very possible to find yourself on a project with people who aren't that experienced with it.

Additionally, I think the type system really pushes you towards object oriented programming. This is fundamentally at odds with the way most people write ReactJS.

Lastly, while deno is becoming a more viable option, most JavaScript development is taking place in node, meaning you have to transpile it. TypeScript adds the overhead of needing a build tool. Using `.mjs` files makes it so easy to spin up a project without any dependencies, something the HN crowd is always kvetching about.

Re: I Switched from TypeScript to ReScript

#23
post #20

Earlier quoted context omitted.

The biggest practical benefits of plain JS over TS are that: * code is terser * the JS standard is more stable/standardised * code can be distributed uncompiled * code has broader tooling support * code can be reasoned about and debugged directly and natively in web browsers without the need for sourcemaps/plugins/etc. * file sizes are generally smaller * there are fewer config files * there are fewer moving parts an…

* no compile time I've been using vanilla JS when not using Reason and it is pretty nice. I hate that safari does not support arrow function methods though (as they allow you to not have to bind `this` in the constructor). concerning you post scriptum in brackets, what I like with types is: 1. refactoring becomes simpler 2. understanding APIs becomes simpler

Which version of Safari are you using? According to caniuse[0], arrow functions are supported in Safari starting with version 10, which is over four years old at this point.

[0] https://www.caniuse.com/arrow-functions

Re: I Switched from TypeScript to ReScript

#24
post #20

Earlier quoted context omitted.

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

The biggest practical benefits of plain JS over TS are that: * code is terser * the JS standard is more stable/standardised * code can be distributed uncompiled * code has broader tooling support * code can be reasoned about and debugged directly and natively in web browsers without the need for sourcemaps/plugins/etc. * file sizes are generally smaller * there are fewer config files * there are fewer moving parts an…

I’ve been a huge supporter of VanillaJS for years. In my opinion, standard modern JavaScript is powerful enough to stand on its own for all of the reasons you state. The biggest problem with transpiled languages is that there is yet another level of abstraction to reason about, so debugging can become quite tricky. Many platforms already make layout and markup too abstract (JSF, Slim, to name a few).

Now, if you’re working with something like Angular, TypeScript makes sense and is portable within that ecosystem, but that’s it.

I once wrote a widget/plugin in pure JavaScript and it worked perfectly well. However, because the project’s “standard” was to use Coffeescript, I was forced to rewrite it in that. Luckily I found a Javascript to Coffeescript converter, which in the end I found extremely amusing because that of course gets compiled to Javascript, which had been written in Javascript in the first place. The resultant code looked like a bad translation of English to Italian and back to English again.

Re: I Switched from TypeScript to ReScript

#25
post #20

Earlier quoted context omitted.

The biggest practical benefits of plain JS over TS are that: * code is terser * the JS standard is more stable/standardised * code can be distributed uncompiled * code has broader tooling support * code can be reasoned about and debugged directly and natively in web browsers without the need for sourcemaps/plugins/etc. * file sizes are generally smaller * there are fewer config files * there are fewer moving parts an…

* no compile time I've been using vanilla JS when not using Reason and it is pretty nice. I hate that safari does not support arrow function methods though (as they allow you to not have to bind `this` in the constructor). concerning you post scriptum in brackets, what I like with types is: 1. refactoring becomes simpler 2. understanding APIs becomes simpler

Fat arrow functions are a core part of ES6. If your version of Safari doesn’t support these, I would argue it doesn’t support ES6.

Re: I Switched from TypeScript to ReScript

#26
post #5

Earlier quoted context omitted.

the only reason I'm using typescript over javascript is types, once I converted a huge code base, there were instances where I fed javascript wrong number of args, or just wrong type of args and it did work (failing subtly on runtime), otherwise is perfectly fine.

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...

Re: I Switched from TypeScript to ReScript

#27
post #5

Earlier quoted context omitted.

the only reason I'm using typescript over javascript is types, once I converted a huge code base, there were instances where I fed javascript wrong number of args, or just wrong type of args and it did work (failing subtly on runtime), otherwise is perfectly fine.

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 order to get my (previously working) code to compile.

I'm not trying to make the conclusion that typescript is bad, as I've hardly even used it at this point. But from my experience, it's not exactly the 1:1 from JS that some people argue. My takeaway is that there can be real value to be had from static typing in JS, but it might not always make sense to introduce the tooling overhead for tiny codebases that are developed by a single maintainer.

Re: I Switched from TypeScript to ReScript

#28

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…

It's a common challenge with any kind of software; as a company, you want to avoid adding more to your stack, even if it means using a suboptimal or boring technology. Every new technology adds complexity and difficulty. Actually I'll just link it, it explains the concept much better (and with pictures!) than I can: http://boringtechnology.club/

TBH I'd stray from using TypeScript in your company stack as well, but I guess I'm just boring.

Re: I Switched from TypeScript to ReScript

#29
post #7

Earlier quoted context omitted.

Here's a great comment explaining all the permutations: https://news.ycombinator.com/item?id=25426438 At least from a branding perspective, it seems the whole thing has been quite bungled. But obviously what's more relevant is how well the technical goals actually get met.

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…

It's certainly confusing, it's a small niche. It may just cater to people who already know functional programming. The majority will stuck in JS anyway to get the job done.

Re: I Switched from TypeScript to ReScript

#30

Why not simply use Javascript? Today it's a fine language. You may complain about fatigue etc which I can buy, but Rescript is simply not solving that.

Obviously there are a lot of people who disagree. I'd expand but it would feel too ad hominem due to your nick :)
Post reply on HN