[00:00] It is September 7th, 2023, and you're watching The Code Report. Many years ago in 2017, legendary JavaScript user Kent C. Dodds said, I don't use TypeScript, so I don't ever plan on supporting it. In 2019, he goes on to say, [00:13] Your impassioned love of TypeScript is sort of freaking me out. And finally in 2023 comes capitulation. TypeScript is one, and it's only a matter of time you're using it whether you like it or not. But this is the sign of a good developer. You have to be open-minded and willing to adapt to new tools, [00:27] and sometimes tools you don't even like. But the big question here is, did TypeScript really win? Because recently, the turns have started to table. A bunch of big open source projects have decided to ditch TypeScript in favor of vanilla JavaScript. [00:39] To understand the shocking turn of events, we'll need to go back to the very beginning, in 2012, when TypeScript was first released by Microsoft. Nobody really cared at first, but then a few years later, it was adopted by the Angular 2 framework, which everybody thought was crazy. [00:53] But here's the thing. First they think you're crazy, then they fight you, then you change the world. Or you go to jail. By the early 2020s, TypeScript was everywhere, at which point most of its haters had been converted into true believers. But now, right as we're about to reach the glorious climax of TypeScript saturation, [01:07] you've got big libraries like Svelte, Drizzle, and Turbo deciding to ditch TypeScript from their code bases. To be clear, that just means that they're not going to use TypeScript when developing these libraries, but as an end user in a framework like Svelte, for example, you're still able to use TypeScript just like normal. [01:22] But how could anyone possibly go back to Vanilla.js after using TypeScript? Do they not remember runtime errors like cannot read properties of undefined? Do they not remember how hard it is to refactor a codebase where you have no idea what anything is? Well, these people are a lot smarter than I am, [01:35] so let's first look at this article from DHH, the creator of Ruby on Rails, who's getting rid of TypeScript in Turbo version 8. The main reason they're getting rid of it is not because of the compile step, but rather because it pollutes the code with quote type gymnastics And there a lot of truth to that especially when developing a library I working on a library myself called Sveltefire and as you can see in the code here [01:54] I have to do my own type gymnastics with TypeScript just to get rid of some red squiggly lines in the IDE. Now, I could simply replace this type with any and not get any type inference, but then my boss would yell at me. He's a total d*** who will abuse me emotionally and physically [02:06] if I don't code up to his standards. It's not easy being self-employed. Furthermore, I have the compiler in strict mode, which means I have to use any anytime I don't want to use an explicit type. And that results in code that's anything but beautiful. [02:18] Let's head over to Turbo on GitHub and see how people are reacting to this change. Well, it's an absolute dumpster fire, and a lot of developers are upset that their TS contributions are now dead on arrival. But another huge project moving away from TypeScript is Svelte, [02:30] and the reasoning is a bit different. It's purely practical, and I recommend you read this post by Rich Harris. Svelte 5, which may come out later this year, no longer uses TypeScript, and Svelte Kit is already written in plain vanilla JS. And the main benefit is no compile step, which is a huge boost in productivity for a large framework like this. [02:46] That may sound like total chaos for a large complex project, but they're actually still getting most of the benefits of TypeScript, but doing so with JSDoc, which is a standard comment format where you declare types and documentation with regular JavaScript comments. [02:59] That can then be used to generate types, like a d.ts file, and most importantly, provide IntelliSense in your editor, so you know what the hell everything does and can catch bugs early, just like you can with TypeScript. That's the main reason I used TypeScript in the first place, so is it time to just ditch it altogether? [03:13] Well, when it comes to building actual applications with a tool like SvelteKit or Next.js, I don't see myself leaving TypeScript anytime soon. Those tools integrate TS seamlessly, and trying to get the same results with JS doc would be a total nightmare. But one day I hope we see the end of this holy war. [03:27] There's currently a stage 1 ECMAScript proposal that would add optional type annotations to JavaScript natively, thus making TypeScript nearly obsolete. This has been the Code Report, thanks for watching, and I will see you in the next one.