Typescript is dead. Long live JSDoc!
Some good ol' twiter drama over types
March 26, 2023
Some nice light-hearted twitter drama ensued over the last week when @jutanium tweeted this:
The replies here are a holy war at this point. Some people are up in arms, while others are cheering on the death of Typescript. Helpfully, @Rich_Harris also provided a lot of context in the replies.
So, of course, it turns out that Svelte is not actually abandoning Typescript, they are just using it in a different way.
Points to note:
- Svelte is a library, and a decision like this makes a lot of sense for them as they can work faster, without a build step. This makes way less sense for apps, which have different set of concerns altogether.
- Svelte uses JSDoc, which has been around since 1990s. JSDoc is very compatible with TS, can generate ts defs, and works very well with intellisense etc. Although Svelte team writes d.ts files by hand, they can in theory generate a large part of them
- As Rich clarified, you will still sometimes need to write d.ts files when using generics for eg.
- There are real advantages to this. See tweet below
So, in conclusion, Typescript is not dead, JSDoc is pretty cool, and we still love both of these. They are just useful for different reasons.
Thanks for tuning in, this was just another day in the JS world :)
PS: This article explains adding types via JSDoc in detail: https://dev.to/manuartero/type-hints-on-pure-js-files-8ee
Still reading? I'll leave you with some choice tweet response:
- Let it burn 🔥
- Svelte is dead!
- Honest appreciation
- Typescript makes code unreadable? Hmmmmmmmmmmmmmmmm
- Well, true, TS is not perfect; but I perosnally feel like I move faster with TS
- This guy just wants more drama. IMO there's no reason to switch to a "new way of thinking" just because someone stared doing it. It's interesting sure. Comes with it's own challenges. We need to look at it with more nuance.
- This one dude tried to tell Rich how he's wrong about JSDoc (!!). This is popcorn material. As Rich says: would you choose a library based on weather it uses spaces vs tabs? (Open this tweet to check out that thread)
- And we'll just leave this one here: