12 ms·
I Switched from TypeScript to ReScript
- kemar 6y agoCool story bro
- ecmascript 6y agoWhy 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.
- netdur 6y agothe 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.
- ficklepickle 6y agoI also like it for not having to constantly check properties before using them. I parse the data once at the application boundary (like after an API call) and then I can use it with confidence.
- ecmascript 6y agoOk 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.
- bbmate 6y agoRecently 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...
- ecmascript 6y agoWell 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.
- s_fischer 6y agoI 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.
- ecmascript 6y agoIt'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.
- root_axis 6y agoBecause of static types. If you're building software that needs to be maintained over time, types are always preferable to a lack of types. This is because types codify the shape of application data structures that exist whether you explicitly define them or not. A lack of types is a form of technical debt that every future developer has to repay as they discover application data structures through trial and error.
- fulafel 6y agoObviously there are a lot of people who disagree. I'd expand but it would feel too ad hominem due to your nick :)
- laurent123456 6y agoRefactoring a large code base is way easier with TypeScript than it is with JavaScript for example. Getting familiar with such a large codebase is also easier with TypeScript thanks to good auto-completion in editors like VSCode.
- fergie 6y agoI 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.
- polyterative 6y agotypescript is liteally a superset of js. what are your benefits
- fergie 6y agoThe 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 and therefore fewer sources of error * there are fewer levels of abstraction and therefore fewer sources of error * etc. (TS diehards will argue that typing ameliorates higher error rates)
- globuous 6y ago* 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
- Ennea 6y agoWhich 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 https://www.caniuse.com/arrow-functions
- sradman 6y ago> 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 https://rescript-lang.org/bucklescript-rebranding
- frou_dh 6y agoHere's a great comment explaining all the permutations: https://news.ycombinator.com/item?id=25426438 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.
- globuous 6y agoGenerally speaking, I am pretty happy with the (small) syntax changes from Reason to Rescript [1]. No necessary semi-colon, arrays, object declaration & access. We can finally pattern match on arrays [2] which I think was not possible with Reason (only lists were). However, there are no custom infix operator with Rescript [1], which is quite sad as it makes monadic code cleaner, whereas they were supported by ReasonML. [1] https://rescript-lang.org/docs/manual/latest/migrate-from-bucklescript-reason https://rescript-lang.org/docs/manual/latest/migrate-from-bu... [2] https://rescript-lang.org/docs/manual/latest/pattern-matching-destructuring#match-on-array https://rescript-lang.org/docs/manual/latest/pattern-matchin...
- richeyryan 6y agoA 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 gone unaddressed for years and instead the community is caught up on syntaxes and compilation targets. I turned to Clojurescript since. It solved most of it's problems years ago and its functional enough that I don't miss the static types. The large standard library also avoids the questions around whether you should use Belt or Tablecloth or any of the other "standard" libraries.
- codewithstein 6y agoI'm actually a fan of JavaScript. Even though TypeScript/ReScript might add some cool features, I don't feel the urge to switch...
- ronenlh 6y agoMy 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.
- joekrill 6y agoI 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 different concepts, approaches, and nuances (or refresh themselves if they've done that but haven't worked on the project in a while). It's a HUGE context switch. At least TypeScript is a superset of JavaScript so it's very easy to get up to speed on for a JavaScript developer, and switch between. For a side project this is fun. But I would never consider this for a "real-world" project (i.e. something you get paid for). At least not anytime soon. Maybe in a few years if there's wider adoption, but that's a long way off.
- Cthulhu_ 6y agoIt'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/ http://boringtechnology.club/
- fxleach 6y agoTBH I'd stray from using TypeScript in your company stack as well, but I guess I'm just boring.
- kiliancs 6y agoNah, you just like risk.
- jfengel 6y agoAs somebody who really, really likes boring, I think it's time to put Typescript in the Boring category -- at least on the client side. Practically all major libraries provide a Typescript definition. Especially React, which has become the boring choice for a lot of client side programming. And you were going to end up using some sort of cross-compiler and packager for significant browser code anyway, just to wrap up all that risk about multiple browsers. That's a bit less clear on the server side, where you have more control. But two things are going for you: if you're going to use Node you might as well use the same language on both sides, and you can cleanly escape to plain Javascript if you feel compelled. (Personally I'd prefer a less sucky language, but honestly, TS makes JS pretty good. Not great, especially with all the legacy warts, but decent, and at least you get to share code with the browser.) TS has survived long enough and become endemic enough that it doesn't look like much risk any more, and it's a vastly better language than plain Javascript -- especially for reducing the risks that come with long-term boring projects. If you're writing JS and like boring, Typescript is looking increasingly like the good, boring choice.
- JacksonGariety 6y ago> 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?
- pantsforbirds 6y agoI think it was supposed to be a comparison to Typescript. Since TS is a strict superset of JS you can simply rename a file and refactor into TS as you go.
- onion2k 6y agoIt works in TypeScript - just rename something from JS to TS and the you have the benefits of TS's types, warnings, and features but your code will continue to work. Untyped things default to 'any', which is useful if you want to migrate a project from JS to TS. It's a very useful feature if you have a mature project in JS that you want to improve.
- ronenlh 6y agoThat'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.
- znpy 6y agoSo what now, TypeScript is not hipster enought anymore ?
- deleted 6y ago[deleted]