7 ms·
I cannot believe how popular TypeScript has become. Is Microsoft running a huge ad campaign? I've used TypeScript for frontend work (Angular 2) for about 6 mon
by jondubois 8y ago
I cannot believe how popular TypeScript has become. Is Microsoft running a huge ad campaign?
I've used TypeScript for frontend work (Angular 2) for about 6 months. I did not renew my contract because I did not enjoy constantly fixing TypeScript configuration, versioning and source mapping issues.
My new company switched to TypeScript for backend work and development across all teams has slowed down noticeably. I spend a lot of my time just discussing with colleagues what types should be called and whether or not we should merge two types together into one or whether or not it makes sense to have two different types to represent essentially the same data in order to enforce different constraints on the user of the data depending on the kinds of functionality that we want to expose.
Then, as we build the project (in an agile way), we have to keep renaming and combining types ALL the time because otherwise we end up with too many different types that sound almost the same and have almost all the same properties but are slightly different semantically.
Also, we spend a lot of time just thinking about what the intention of the user should be and all the ways in which we can impose contraints on them instead of correctly acknowledging that the user will always find some way to do whatever the heck they want and that all this strict typing adds no real value once you introduce the human factor.
Ironically, the so called 'stupidity' which TypeScript aims to protect the code from will find even more compex, more creative and less obvious ways to express itself within that code.
- tekkk 8y agoWhat are you talking about? Lost productivity compared to what, JS? Merge types? You can just use `&` to combine them if need be? Discussing types? Does it matter that much, and I mean refactoring them isn't a big deal if need be. Two different types represent essentially the same data? You've tried extending interfaces or using generics? Seems like you lack an experienced TS developer in your team and are contributing your lack of experience as a fault of the language itself. The typing has saved my ass maany times and makes the code in our projects actually maintainable for us and for someone outside of our team's bubble. It might take a while longer to code the app, but it'll take less hours in the long run to keep it safe and working.
- jondubois 8y agoI started coding with ActionScript 2 and then switched to ActionScript 3 (ECMAScript with types; basically the same as TypeScript) for years starting at a very early age. Then I did Java and C++ while at uni. Then I used JavaScript for several years (and did some half year stints with TypeScript in between) so I have a more balanced experience with both statically and dynamically typed languages than the vast majority of developers (I have over 15 years of experience in total: Slightly more with dynamically typed languages). I also maintain several open source projects in my own time so I work many hours per week. Also, I'm currently working on a TypeScript project (second time in the past 2 years). Also, I've spoken to several very senior developers (including some influential individuals) who also have broad experience and who share my point of view. So that's why I feel confident when I say that TypeScript does not add any actual safety. I don't have skin on either side (well actually my current employer uses TypeScript so saying bad things about TypeScript does not align with my career interests) and I really did give both a really fair, thorough trial with an open mind. As I said, I even switched back and forth between them for extended periods to gain more perspective. Typescript solves a few small but obvious problems and introduces multiple new problems that are worse but less obvious (it makes the details of the code better, but the overall foundation and the process worse).
- tekkk 8y agoI am curious, so do you then prefer JS over TS? It still feels to me that you're doing something wrong, and are finding any reason to blame the language. I had very negative views about TS when I did some hobby project with it was it 3 years ago. I felt it only added confusing boilerplate, that hindered my ability to code. But a lot of it was just my own inexperience with the type system, and I was getting stuck many times because I didn't know how to use it. Now it feels like a breeze and I take shortcuts when I need them, and add the interfaces when it feels necessary. It was a bitter thing to swallow, to admit to myself that I just hadn't understood TS and reverse my views once I got hang of it. Sometimes when you first have a bad experience with well basically anything, you'll be viewing it with the same negative emotion throughout your life. If so many people, experienced and inexperienced developers alike, are saying good things about TS maybe there's something there that you just haven't discovered? >Typescript solves a few small but obvious problems and introduces multiple new problems that are worse but less obvious (it makes the details of the code better, but the foundation worse). Care to elaborate?
- cageface 8y agoI've had exactly the opposite experience. Our typical JS apps turn into giant hairballs of ad hoc data. Refactoring is basically impossible. We just did our first all-TS project and the difference in maintainability has been night and day. If I have anything to say about it we'll never do another JS project without types. If you're having this much trouble defining the types in your app I suspect your data structures and flow might need some rethinking. There are way more large codebases written in typed languages than untyped languages so the idea that types are an obstacle to development just isn't convincing.
- cheez 8y agoBased on what you've written here, it seems like your development process is at issue.