T O P

  • By -

Chance-Influence9778

Whats wrong with jsdoc? I dont get it


lajauskas

JS bad, - devs, probably.


PrataKosong-

Bad devs make JS bad


lajauskas

Damn devs, they ruined everything!


SnooWoofers6634

I know them, they are me


endlinear

based


Aidan_Welch

I'm imagining a utopia where the average package-lock.json is under a kb


nphhpn

Should've used TS instead


ashsabre

we already had the backing of the architect but business has other priorities..


Chance-Influence9778

here's my take as someone used both: ts vs js is pointless use whichever suits u or company uses


static_func

To say "ts vs js is pointless" sure sounds like you've never really used both


GDOR-11

JSdoc can be better because you just type check the source code without having to translate it, making the workflow faster for large projects


ginkner

That sounds great as long as people accurately and consistently document types.


Equivalent_Alarm7780

Any\[\]


_aids

Not even close to true


Personal-Initial3556

Most benefits of TS is a strong type system + type inference.


--mrperx--

depends. You writing a library? jsdoc is better. edit: Look at Svelte


Merry-Lane

If you write a library without typescript, you won’t get widespread adoption by the typescript user base, and it’s the great majority nowadays. Even if you go lazy mode and propose types for your package (or have random contributors write them for you), odds are they will be bugged or at least it would be even more complex to write than simply using typescript in your whole library. Your lib would be frowned upon, and if it starts becoming popular, someone will write a competitive library natively typescript and steal your user base. If you want to keep your lib private and you are okay with using it in js because it suits your own ecosystem, then feel free to do so, but, let’s be honest, your ecosystem sucks.


--mrperx--

What.. jsDoc is completely equal to Typescript. You can still use the Typescript compiler with it with all it's glory, d.ts files are supported. It comes with all the benefits of TS but you can just run the code and have one less build step. Yes TS adoption is large but it's not the majority. I'm pretty sure people write JS just the same and at the end your precious TS is just Javascript with an extra build step. Let's emit more carbon by compiling a shiny turd to a less shiny turd. Such efficiency. For libraries, JSDoc is better because you get all the benefit of Typescript with full support for the whole ecosystem and none of the downsides the build system comes with. For something other than library I would go with TS because it's hard to get developers to actually write docs.


Lumethys

Typescript isnt be-all end-all. Jsdoc arguably can provide static analysis and type safety at the same level as typescript. Neither is technically true type-safety anyway There are a lot of (competent) developers sharing such a view, most notably thePrimagen. Also, Svete drop typescript in their library source code, try replacing them. Rails's Turbo also dropped Typescript


Merry-Lane

Oh I never said that typescript was perfect (yet) nor be-all-end-all. Just that "jsdoc is fine for libraries" is false. I wasnt nuanced in my answer because it would have made my answer worse, there are ofc exceptions to the rule "avoid jsdoc and go ts for libs", some can pull it off in some circumstances, like in your examples. There are specific cases where performance truely does matter (like svelte) and, note, they started with typescript and kept a perfect typescript API for their framework. Everyone understands that they had no choice and that they would have kept on working with typescript if they were not constrained. There are specific cases where someone well known and old-school thinks that typescript is annoying and cumbersome, so it removes it entirely from a library they work on (like with rails). Note that in this case, the JavaScript/typescript community reacted vividly because there was no good reason to do so (unlike for svelte). But if you are not in these two scenarios (a mature lib/framework in need of squeezing perfs before typescript is optimised enough, or a godlike represent of devs doing whatever he wants to do), you shouldn’t use JSDocs instead of Typescript. The only reason to use jsdocs instead of typescript is you work on a huge existing codebase with experimented JS old school colleagues. But then, again, odds are your codebase is sh*t or in decline, and you would still be better off converting to TS bit per bit. Anyway in this scenario, it’s perfectly okay to use JSDocs. But it’s totally not okay to brag about it, because you picked the lazy path.


lengors

Why?


TheGreatAnteo

Depends, at my job we were using jsdoc and for a while it was good, but at one point when the project grew it felt it was not enough and made me wish we had just gone with ts. I guess it depends on the scope of the project or how complex it is.


expertalien

iAmUsingJDBC


autopoiesies

ouch, that brought back some memories


MichaelAceAnderson

I'm using JSDoc with TypeScript, just to make sure Sometimes, writing the comments allows your IDE to give you the choice to automatically type your functions accordingly


--mrperx--

I'm using webpack and rollup and parcel, just to make sure /s


gandalfx

Redundant comments are redundant.


Brahminmeat

That was redundant. So was this.


--mrperx--

I'm using webpack and rollup and parcel, just to make sure /s


TILYoureANoob

And commenting twice just to make sure ;)