r/javascript • u/Firemage1213 • Mar 12 '26
AskJS [AskJS] JSDoc Reality Check
Are we finally allowed to admit that using JSDoc to avoid a build step is actually worse than just writing TypeScript?
I am tired of pretending that writing a 40 line, heavily nested type definition inside a massive green comment block is somehow "cleaner" than just using TS. I get the appeal of zero build steps and shipping raw JS, but watching developers bend over backwards to write perfectly formatted u/typedef syntax just to appease their LSP feels like we are completely missing the point of why we adopted types in the first place.
View all comments
Show parent comment
1
u/prehensilemullet Mar 12 '26
Despite its complexity I still find that TS saves me a lot of time by a) catching mistakes that would take a lot longer to find by any other means and b) providing really good intellisense.
I came from Java and it's a breath of fresh air just to have something catch null dereference errors for me.
Without good intellisense I'd have to spend 50% of my time just verifying that I'm using the right names for imports, functions, and properties. Some of the projects are way too big for me to hold all of the names for things in my head. Maybe your projects are a more manageable size?
I don't really understand why you think it seems like high boilerplate, TS has less boilerplate than Java, C++, sometimes even Rust in my experience. If you're comparing it to languages without type declarations like Python or Ruby then sure, the types are more boilerplate, but the only reasonable comparison is to a language with type declarations.
I agree that a lot of people are trying to bring in foreign language features that don't fit, but the addition of classes seems practical and beneficial to me. The class syntax is generally a lot more concise than
Foo.prototype.method = function method() { ... }, its main weakness is that you can't break up the method definitions into multiple files if the methods are long. I'm not into doing ridiculous OOP inheritance hierarchies like in Java, but occasionally I find it reasonable to declare a class. What I really don't think is a good fit are Java-style @annotations that people are pushing to add to JS.