7 ms·
Personally, I’m not a huge fan of TypeScript. I feel it’s unnecessarily verbose at times. I used ReasonML for a while, and I absolutely LOVED it. I’m just bumme
by koprulusector 5y ago
Personally, I’m not a huge fan of TypeScript. I feel it’s unnecessarily verbose at times. I used ReasonML for a while, and I absolutely LOVED it. I’m just bummed about the uncertainty of the projects future and adoption and the lack of alternatives that seem to make TypeScript the defacto standard.
- draw_down 5y agoI agree, however its utility outweighs that in a large org. It’s basically indispensable for frontend programming at scale. Having dozens or even hundreds of people contributing to a codebase without it (or equivalent) would be chaotic and painful.
- tasogare 5y agoSuper set of JS instead of a beging a totally different language, fix its main issue (lack of useful types for error checking and refactoring), adopted by many projects, backed by Microsoft and quickly releasing new versions: there is no wonder it's replacing JS where it can.
- dnndev 5y agoIt’s a fad. Give it some time… it’s not the first layer on top of JavaScript someone has come up with. Microsoft drops project all the time- this is a stunt on their part to attract devs and it’s actually working for now.
- draw_down 5y agoIt’s a “fad” in the same sense React is
- lstamour 5y agoThere was a time when folks said the same thing about Node.js...
- BoorishBears 5y agoI don't know how anyone who's actually used plain Js and Ts in a large project can say it's a fad. For frontend it might be different, but as someone who usually touches the Js ecosystem through node, I pretty much won't use Js. Like why should I give up insane utility with negligible (if any) runtime cost, high configurability (with sane defaults), easy buy in (since all Js is valid Ts)? Maybe the last part is what you're missing? Most "layers on Js" needed you to rewrite or annotate all your code to get and value at all. But you drop a tsconfig in a project and you instantly get value out of it. What past layer on Js had that?
- nsonha 5y agoI guess python 3 typing is also a fad? They're pretty similar in goals
- aikah 5y agoIt's not a fad, it's based on JS.net and Actionscript (ES4) syntax that existed well before Ecma Script 5 existed. Microsoft has been iterating over Typescript for about 20 years.
- fenomas 5y agoLately I've gotten into the habit of giving my pure JS projects a tsconfig.json file, so that my editor runs the files through tsc and I get all the code hints and errors it reports. I find that as long as the code is reasonably straightforward, I get most of TS's benefits without actually declaring any types. It was kind of a pain to originally set up, but the code hints really are pretty magical.
- derekbaker783 5y agoSame here (along with some JSDoc type annotations). This works well.
- fenomas 5y agoYes exactly - when tsc you really want code hints for an object, but tsc can't guess its type, you can do: /** @type {import('../index').Engine} */ this.engine = engine Most of my projects have a god object at the center, so if I explicitly type that one object then I get basically all the important code hints for free. A side benefit of this is that you can also use TypeDoc to generate docs. It's not really made for vanilla JS, but once I got over the initial road bumps I've been happy with the results.
- nsonha 5y agotypescript is only slightly more verborse than reason (or is it rescript?), the syntax is almost identical (does reason still have those annoying explicit ocaml/js conversions?). At this point the features that ts has and reason doesn't out number that of the other way around. I only know that reason has more stringent jsx types and opaque types (easily done in ts in 2 lines of code). On the other hand ts has mapped types and conditional types, weird as they are, pretty unique to itself. In the future, expect ts to be even more functional and absorb ideas from F# which is also from microsoft.
- aikah 5y agoPeople here forget that typescript is both a language and a static code analyzer for Javascript. You don't have to use Typescript syntax to use. You can write plain old Javascript and still use Typescript compiler to make sens of your code. You can't do that with ReasonML, you are forced to adopt another language that is not Javascript.