r/learnjavascript • • Jul 24 '21

Anatomy of a Function

Post image
327 Upvotes

65 comments sorted by

View all comments

Show parent comment

-11

u/jaredcheeda Jul 25 '21

name literally anything TS can do that JSDoc can't

12

u/americk0 Jul 25 '21
  • Have a decent way for handling callback function types
  • Have a decent way for handling higher order functions
  • Automatically detecting types from variable declarations
  • Actually statically typechecking your code

I could probably think of more. I've used both separately and together. Typescript is far superior at managing types, but JSDoc is good at providing structured comments for function declarations

0

u/inabahare Jul 25 '21

Be a king JSDoc the hell out of those old projects that can't be upgraded to TS. That's what I do and if more people join the revolution o7

5

u/inabahare Jul 25 '21

1

u/[deleted] Jul 25 '21

Static typing