Remix.run Logo
paulddraper 2 days ago

And in fact, this what the Closure Compiler does…typecheck based on JSDoc.

However, the precision and completeness is not nearly what can be expressed in TypeScript. With generics particularly.

culi a day ago | parent [-]

Care to give an example? In another reply I pointed out how advanced JSDoc syntax's support for generics is.[0] Even allowing for `extends` and default values for generic slots.

The clunkiest part is in the way you "pass in" a generic to a slot. But this is solved by typing the return type.

I use generics pretty extensively and I've not yet come across a use-case JSDoc couldn't handle

[0] https://news.ycombinator.com/item?id=46267810

paulddraper 18 hours ago | parent [-]

Ah.....you're putting TypeScript in JSDoc annotations.

Which is a lot different than vanilla JSDoc [1].

I understand.

[1] https://jsdoc.app/

culi 7 hours ago | parent [-]

JSDoc doesn't have a formal spec. Most modern development on JSDoc syntax happens by the TypeScript team. Every release of TypeScript also includes notes about JSDoc syntax.

Almost any modern IDE is also parsing JSDoc comments through the TypeScript language service. So many people don't realize they are already using TypeScript (hence the name of this post).

I don't think it's particularly controversial to say that the form of JSDoc that the majority of developers are familiar with IS JSDoc. The distinction is more of a historical one than a technical one (since there is no formal JSDoc spec)