How to extend a typedef parameter in JSDOC?
I found this solution and this works very fine for me. originally from here /** * @typedef {Object} ChildType * @property {String} childProp * * @typedef {Base & ChildType} Child */
I found this solution and this works very fine for me. originally from here /** * @typedef {Object} ChildType * @property {String} childProp * * @typedef {Base & ChildType} Child */
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
You can achieve that, by doing this: /** * @param {(1|2)} type */ function useTypesEnum(type) { }
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
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
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
@example http://code.google.com/p/jsdoc-toolkit/wiki/TagExample /** * This function does something see example below: * @example * var x = foo(“test”); //it will show “test” message * * @param {string} str: string argument that will be shown in message */ function foo(str) { alert(str); }
There are two proper ways of dealing with line breaks in JSDoc. The first, apparently used by Google, is to indent the lines after the first: /** * @param {string} author – The author of the book, presumably some * person who writes well and does so for a living. This is * especially important … Read more
Import the declared type in your file File2.js using the function import. const persons = require(‘./File1.js’); /** * @typedef {import(‘./File1.js’).MyObject1} MyObject1 */ class File2 { … It works for me.
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