An Interest In:
Web News this Week
- September 18, 2023
- September 17, 2023
- September 16, 2023
- September 15, 2023
- September 14, 2023
- September 13, 2023
- September 12, 2023
Some of Our Sources
- Just Creative
- TutsPlus - Design
- Freelance Switch
- Design Modo
- Web Resource Source
- Android Headlines
- Daily Now
- Dev To
JSDoc in TS and JS
Two days ago, I wrote a post about JSDoc.
The post was about using JSDoc for type checking, and it received over 60 comments, including my own replies.
Some of the comments were critical of JSDoc's type checking capabilities, while others defended JSDoc's ability to provide complete type checking.
I was curious about the repetition of the same question and answer, and I realized that we were talking about different JSDoc.
In TypeScript, JSDoc is a pure comment.
Although it provides some information when we hover over the code, it does not support type checking at all.
By adding a few settings to
This is in stark contrast to the incompetent JSDoc of TypeScript.
Also, even in cases where JSDoc is written but not used with TypeScript, such as in an eslint project, JSDoc is simply a comment.
I agree to some extent that JSDoc can be aesthetically horrible, and it is hard to argue against that.
However, I hope that the misunderstanding that JSDoc does not support adequate type checking will be cleared up, and I will leave an example below of how TypeScript and JSDoc can be used to perform the same type checking.
Original Link: https://dev.to/artxe2/jsdoc-in-ts-and-js-1p6j