15 ms·
JSDoc provides type annotations in comments. They are (mostly) not for you. They are for the tooling, including your editor, to detect that your declared foo(
by kjksf 4y ago
JSDoc provides type annotations in comments.
They are (mostly) not for you.
They are for the tooling, including your editor, to detect that your declared foo(bar: string) but you're calling it as foo(5).
The value of JSDoc is the same as value of TypeScript: add static types to your code to detect bugs.
And yes, it works in practice.
I started using JSDoc quite recently.
I don't enjoy adding those type annotation comments but undeniably they (and VS Code tooling, jsconfig.json) detect errors that, if not fixed, would end up blowing up at runtime and causing me to spend more time fixing them.