How to annotate Express middlewares with JSDoc?

Use DefinitelyTyped Install express types npm install –save-dev @types/express use e.Response as usually @param {e.Response} res More types in file /node_modules/@types/express/index.d.ts for Response it is e.Response because: … declare namespace e { … export interface Response extends core.Response { } … WebStorm install types via Settings > Languages & Frameworks > Javascript > Libraries > … Read more

Mixing JavaScript and TypeScript in Node.js

Yes this is possible. Combine the following TypeScript compiler options –allowJs Explicitly supports mixed JavaScript and TypeScript sources –outDir Since all files will be transpiled, it is necessary to output the resulting JavaScript into a different directory otherwise the input .js files would be overwritten1. –checkJs This is completely optional. If specified, the compiler will … Read more

jsdoc valid param types

The JS Documentation tooling I’ve used just tokenizes the comments into strings anyway, making it possible to put anything you want in the {type} section. You could stick with JavaScript types if you wanted like {number} or {string}, or if you want to specify you could do {integer}… but I would probably recommend something like: … Read more

How to easily create Github friendly markdown for documented JavaScript functions?

I use jsdoc-to-markdown.. write documented code: /** a quite wonderful function @param {object} – privacy gown @param {object} – security @returns {survival} */ function protection(cloak, dagger){} get markdown docs: $ jsdoc2md example/function.js #protection(cloak, dagger) a quite wonderful function **Params** – cloak `object` – privacy gown – dagger `object` – security **Returns**: `survival` These projects have … Read more

Best way to document anonymous objects and functions with jsdoc

You can document stuff that doesnt exist in the code by using the @name tag. /** * Description of the function * @name IDontReallyExist * @function * @param {String} someParameter Description */ /** * The CallAgain method calls the provided function twice * @param {IDontReallyExist} func The function to call twice */ exports.CallAgain = function(func) … Read more