I hate to be the outlier, but I never thought it totally sucked - I always missed static typing in JS. My only gripe was that the tooling wasn't tremendous in the early days (fantastic now). If memory serves you needed full fat Visual Studio to use TS 0.8. But that was looooooong ago!
I learnt java in school, but the first language I really truly learned was js.
Loose dynamic typing was something I was very used to. Learning TS was extremely frustrating at first. I didnt realize how often I was coding with only a vague idea of the types.
The refactor thing is so true, I'm working on a project that I may be able to take to market. It's a new codebase so I change my mind a lot while I can, and when type safety is setup properly you can just change something big, run tsc --noEmit and go through each problem. Then, it all just works!
This isn’t me. I learned to program on ActionScript 2 and then 3. AS3 had very similar types to TS at the time and I was 100% on board from the beginning. But this graph explains so many of my friends and colleagues. One took a full 9 years to convert
I've noticed that people coming from strongly typed languages to TS, had more issues with it than less.
They see types and expect them to work a certain way. The see an assertion and call it convertion.
There's a fundamental misunderstanding of what TS is, that leads to "fun times in production".
That helped me to switch my mental model for sure. But that dip in the hype graph for me was because it’s a whole new set of stuff to learn. Like another language. I kept googling “[css rule] tailwind”. Once I learned enough to not google every other tailwind class name I started to love it.
For me docker had the exact opposite. Like this hype graph in reverse. The upsides were immediately apparent and I wanted to use it for everything. The downsides revealed themselves as i gained more experience. Then a period of never wanting to use it. And now I’m ok to use it sometimes
The others side of the coin is learning when and how to lie with TS.
Mostly to place artificial constraints on the code to avoid the unhappy paths, to lower the mental overhead of the API, or to simply reconcile irreconcilable things.
Instant love for me having had my ActionScript 3 bubble burst in 2010. Moved back to JS with first full TS project in 2014 🤩. Other than tsc being quite slow back then, it was like being able to breathe again.
For me, TypeScript was like a messiah. It wouldn’t say that I hated JavaScript, but I really missed the strong types that I was accustomed to from C#, and TypeScript fixed this, even though ‘any’ was often used in the beginning. Integrating TS in the build pipelines was often straightforward.
I think it's worth adding that my experience is that TypeScript's type system has surpassed C#'s. It really feels like a step backwards, when I have to make changes to our backend code.
There was that period of time it from 2020-early 2022 when if you were learning ts you were going super saiyan and the cool thing was to hate on learning it
This was also one of the first times I felt confident as a dev cause I was learning it as a new dev and very senior ppl were struggling too
one thing that bothers me a lot, as a person struggling with apathy, is how nightmarish TS build process is for libraries. it really sucks that TS has to be compiled. the alternative, using TS-powered JSDocs, is not a whole lot better. Deno shows things can be better, but Deno is not a solution
I am not against TypeScript but I am one of those JavaScript but use all the JSDoc / ts-check / jsconfig setups in VS code. To not do that is simply asking for trouble. This also for my own stuff.
"Falling in love" and "thinking it sucks" are both limiting perspectives on TypeScript. It's a remarkable piece of pragmatic programming language tech that bolts some sanity on top of JS and its ecosystem - but all the warts of JS are all still there. The Web should aspire to better.
Honestly I don't understand how anyone could be against TS at this point. The fact that I can do a large refactor and know with 100% confidence that I got everything is a game changer
Yep, that’s me. Really didn’t like structural typing to begin with but have come to quite like it. I do wish we had a way to express “exact” types (no extra fields), though.
I'm pretty sure there are some utils out there that let you do that. IIRC they "never" all the keys that are not part of the given object or something like that.
I fully understand why Object.keys is typed the way it is, but it’s such a common little ergonomic stumbling block. Indexing into stuff in general is a bit weird. Sorta feel like indexing into objects not returning an optional type by default is a sharp corner, too.
For the object keys, I think the quirk has meant that I almost always favour a Map over a Record, unless the object is immutable like config and there I’d use “as const”…
I can think of at least one time when no unchecked indexed access would have prevent a bug in production — but it does require quite a bit of refactor on large codebases.
This 👇 seems more relevant to me personally. I stayed at square one (quite literally) mostly because I couldn't wrap my head around `tsconfig.json`. 🥴 Once I figured that stinky part out, I migrated around 60 repositories in a matter of weeks, feeling nothing but pure joy in the process.
My graph is probably reversed. I immediately liked TypeScript when I first uses it but between using other typed languages and slow tooling my opinion has gone down
I wonder what it would be like now for folks learning TS with all the fantastic learning paths available. I hope the "pit of despair" is shorter and shallower than it was for me 😅
If you work in a team of 2 or more, TS provides several benefits, over just plain JS. And I never felt this confidence to refactor code like in TS code bases
I initially discarded using it in several projects, because it was slowing us down. Glad I ended up reconsidering it
Missing: "How did this even work" when you connect an older JS(X) to your newer TS(X) and realize how everything 90% ducktyping blackmagic, 10% raw luck your API never sent the wrong type but could have.
1. Nah, too slow
2. It might help, but JS is faster to write
3. Ok it is great, but still slow, let's get back to JS
4. Shit, what happened to my JS code i cannot trust it anymore! My code feels so incomplete without types!
5. Let's get back to TS without tryharding complex features from start...
I just can't program without types anymore. The mental load gets much easier when I don't have to search and think which options I can pass to functions etc.
Recently I got to a project which is written in JS only. I rebel a bit and at least put JSDoc where available.
Coming originally from C/C++ and C#, I never went through the pain. In fact, I’m surprised the community took so long to make the switch to type safety. IMHO it’s basically irresponsible to build any system at scale without type safety.
It is interesting how much more hype TypeScript has over Typing from Python's standard library. TypeScript is obviously helpful, but I think every TS dev has had moments where they've (maybe needlessly) wrestled with some obscure typing challenge.
Personally, I feel like type annotations are incredibly useful when working with external APIs or unknown sources of data that may not be defined directly in my codebase, like for example reading a file that isn't checked into the code. What is the shape of the data in the file?
Living the exp a little different. Yet, I have not thought it sucks but definitely I am having quite big challenges some days. Additionally, for any big project I am in the state that “we should use ts”. Anyway. One day I might fit onto this curve at one point but where and when idk. :)
Absolutely! I was on the far left side of the graph for a long time, until experience moved me to the far right! Oh shit, please don't quote me out of context!
I went from AngularJS to Angular 2. There was no ESLint for TS. TSLint just wasn’t as good. Prettier wasn’t really a thing yet. Moving to React later with just JS(X) and prop types was a breath of air again.
It sucked so hard that my then senior advisor, had to take me for a serious talk because I was ranting so much that he thought that I was going to quit. After some sessions with him (and actually some videos of you) I am a changed man! 😂
Comments
Loose dynamic typing was something I was very used to. Learning TS was extremely frustrating at first. I didnt realize how often I was coding with only a vague idea of the types.
I thought I had it all in my head.
They see types and expect them to work a certain way. The see an assertion and call it convertion.
There's a fundamental misunderstanding of what TS is, that leads to "fun times in production".
Same thing with @tailwindcss.com as well to be honest.
- JSX
- GraphQL
- Docker
I am probably missing a few
*add TS, enable strict mode*
"Oh wait, more than half of my code can break in ways I didn't anticipate"
This is incredibly useful if you're writing any kind of code that's intended to be used by other devs.
Mostly to place artificial constraints on the code to avoid the unhappy paths, to lower the mental overhead of the API, or to simply reconcile irreconcilable things.
This was also one of the first times I felt confident as a dev cause I was learning it as a new dev and very senior ppl were struggling too
In a big web app, use TypeScript for sure. 🙃
It was such a relief having the compiler tell me, here that could be null j and you didn't check. Code quality did a leap right there.
I was totally in the "nah, I don't need this, my code is good. And the added cost of tooling sucks" camp. Now, I don't wanna do anything without TS. 😀
A manageable toil is adapting to other people's complicated types. And that person can often be your past self.
A massive toil is compilation speed in massive repos.
Exempli gratia: https://github.com/guardian/dotcom-rendering/pull/6609
https://www.typescriptlang.org/play/?#code/C4TwDgpgBAogHgQwMbADwBUA0UDKALBSAPigF4AoKKdKCOYCAOwBMBnXAySqqAfljhIANgFdmEVAGsIIAPYAzatmlzF+QhBJ0GLdowgA3CACco3Hj341zFqAC4o+o6ZsOnJgNzlyoSFADCCKakUADeNowIALYQDqzAxgCWjADmXhYgEEFuIlEARp7kAL7eSLKM8VDyjGRQGJhEABTJYCLADvDIaFgBQUQAlGQkZRWyQhAAdEKyKY2hUC1tUEX9XuQjlXRdtfORMQ4ARKyyMcB4ySkH2JnZUACMABwA7ADMy14bwFDAsrIAsghGCAdo5orEoEcThAzhcrlAbsYHI9XthZGcTIc8BAhNMDkU1tVGlsUKtyISfv9ASBVkA
I am very curious why some people seem to get stuck there
🤣
Rename symbol is a good example
I initially discarded using it in several projects, because it was slowing us down. Glad I ended up reconsidering it
Love the hints that pop up throughout VS Code so I don't have to remember what all the function and object properties are.
It took me a while to realise that I didn’t hate typescript itself. It turns out I hated poor implementations of it.
My love for TS began once I understood type inference. Never looked back since
2. It might help, but JS is faster to write
3. Ok it is great, but still slow, let's get back to JS
4. Shit, what happened to my JS code i cannot trust it anymore! My code feels so incomplete without types!
5. Let's get back to TS without tryharding complex features from start...
Recently I got to a project which is written in JS only. I rebel a bit and at least put JSDoc where available.
Also the way how generics used to work in the beginning, was something that scared people away.