DEV Community

Discussion on: Sell Me On Typescript

Collapse
 
psypher1 profile image
James 'Dante' Midzi

Granted, I could have chosen better wording. Most of the times I come across people hyping TS it's usually "it'll make you faster". The way I work, fast is not a metric I focus on. But using that, I have spent more time doing something in typescript than I would have if It were just JavaScript.

It's not that I don't like it, I'm just not convinced more than anything. JSDoc you say, I'll have a look at it .

Thank you

Collapse
 
peerreynders profile image
peerreynders

I like the idea of JS Doc TS but in my judgement you have to be good with TypeScript first before trying to tackle JS Doc TS (and it has an even larger hurdle for initial setup). The best JS Doc TS example I know of is Preact.

Thread Thread
 
psypher1 profile image
James 'Dante' Midzi

Oh boy....

Collapse
 
tqbit profile image
tq-bit

Most of the times I come across people hyping TS it's usually "it'll make you faster"

The thing here is - it does make you faster on 'common' development projects. This implies, you:

  • work in a team
  • have a dev workflow including code review, exhaustive testing, and so forth
  • re-write a bunch of features in each sprint phase

I think not being convinced is okay. My portfolio is written in JS as well. And I see no good reason to rewrite it just for the sake of adding Typescript to the codebase. The last two hackathons on dev.to, I wrote using Typescript. I didn't work on them regularly. Since they use several layers of abstraction, VSCode's TS intellisense was really helpful to understand

  • function / method argument types
  • return value types
  • how to instantiate a class
  • getters from Pinia

That's what I meant about the "you'll thank every developer later" part. The less mental capacity you use memorising what you built earlier, the easier it is to plan what to write next. Or whether you can re-use or refactor your modules.

Thread Thread
 
psypher1 profile image
James 'Dante' Midzi

This makes sense. When I do work on a project that uses it, then I'll dedicate more time to. As of now, I don't have a valid reason...

The whole affair drove me to build the portfolio with Eleventy instead - to actually see what javascript is necessary for it. For that, I'm grateful

Thread Thread
 
peerreynders profile image
peerreynders • Edited

Last time I checked there were additional hurdles to using TypeScript with 11ty.

Enough for me to consider using Astro instead if TypeScript was a critical consideration.

Thread Thread
 
psypher1 profile image
James 'Dante' Midzi

Oh no, Eleventy was after... I was initially building in Next.js with TS..

Then the TS thing made me decide to forgo frameworks altogether