Hacker News new | ask | show | jobs
by alerighi 1133 days ago
> Very rarely we find a case that we can't cover with JSDoc annotations, and most of the time it means the code could be refactored to be simpler.

Can with JSDoc define types? And can you define generic types? To me that is the real power of TypeScript, being able to type every object you use.

2 comments

Yes you can with @typedef and @template
for those interested, https://jsdoc.app/tags-template.html is 404 but https://github.com/google/closure-compiler/wiki/Generic-Type... appears to be the thing (reinforcing my rage at the JFC situation with JSDoc specification)
and you can always define more complex types in interfaces and import into jsdoc.