How do I properly JSDoc the function below?
function foo() {
foo.counter = 1 + (foo.counter || 0)
}
Currently TS type checking (in vscode, with checkJs=true) complains:
Property 'counter' does not exist on type '() => void'
How do I properly JSDoc the function below?
function foo() {
foo.counter = 1 + (foo.counter || 0)
}
Currently TS type checking (in vscode, with checkJs=true) complains:
Property 'counter' does not exist on type '() => void'
You can document static members with JSDoc. I would use a namepath for this and so an extra block:
function foo() {
}
/**
* My static counter
* @name foo.counter
* @type {number}
*/
foo.counter = 0;
Now my IDE (VS Code) is able to see it as a property and pull out the documentation: