Video 5ChkQKUzDCs
AI Summary
The video explores the recent trend of major open-source projects like Svelte, Drizzle, and Turbo ditching TypeScript in favor of vanilla JavaScript, despite TypeScript's widespread adoption. It examines the reasons behind this shift, including type gymnastics and compile step overhead, and discusses alternatives like JSDoc.
Kent C. Dodds initially opposed TypeScript in 2017 but later accepted it, illustrating the importance of adapting to new tools.
TypeScript was released by Microsoft in 2012, gained traction with Angular 2, and became ubiquitous by the early 2020s.
Svelte, Drizzle, and Turbo are moving away from TypeScript for their codebases, though end users can still use TypeScript.
DHH argues TypeScript pollutes code with type gymnastics, especially in library development.
The Turbo GitHub issue became a dumpster fire, with developers upset about dead TS contributions.
Svelte 5 drops TypeScript for faster development, using JSDoc for type checking and IntelliSense.
A stage 1 ECMAScript proposal could add optional type annotations to JavaScript, potentially making TypeScript obsolete.
While TypeScript remains valuable for application development, the trend of libraries moving to vanilla JavaScript with JSDoc suggests a shift towards simpler tooling. The future may bring native type annotations to JavaScript, ending the holy war.
Clickbait Check
85% Legit"Title accurately reflects the content: TypeScript's dominance is being challenged by major projects reverting to vanilla JS."
Mentioned in this Video
Study Flashcards (6)
What year was TypeScript first released by Microsoft?
easy
Click to reveal answer
What year was TypeScript first released by Microsoft?
2012
00:39
Which framework's adoption helped TypeScript gain traction?
easy
Click to reveal answer
Which framework's adoption helped TypeScript gain traction?
Angular 2
00:39
Name three open-source projects that decided to ditch TypeScript.
easy
Click to reveal answer
Name three open-source projects that decided to ditch TypeScript.
Svelte, Drizzle, and Turbo
01:07
According to DHH, why is TypeScript being removed from Turbo?
medium
Click to reveal answer
According to DHH, why is TypeScript being removed from Turbo?
Because it pollutes the code with type gymnastics.
01:35
What alternative does Svelte use to get TypeScript benefits without a compile step?
medium
Click to reveal answer
What alternative does Svelte use to get TypeScript benefits without a compile step?
JSDoc
02:46
What is the stage 1 ECMAScript proposal that could make TypeScript obsolete?
hard
Click to reveal answer
What is the stage 1 ECMAScript proposal that could make TypeScript obsolete?
Adding optional type annotations to JavaScript natively.
03:27
🔥 Best Moments
Kent C. Dodds' TypeScript Conversion
Shows a prominent developer's change of heart over time, illustrating the industry's shift.
00:00DHH's 'Type Gymnastics' Critique
A sharp, memorable phrase that encapsulates a key reason for abandoning TypeScript.
01:35Turbo GitHub Dumpster Fire
Highlights the intense community backlash when a major project changes direction.
02:18Full Transcript
Download .txt[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.