Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make link of method parameter type in jsDoc

Tags:

jsdoc

Is there any natural way or special tag to make parameter type as link? enter image description here

/**
* My js app
* @module app
*/
/** 
* Namespace for MYAPP classes and functions.
* @namespace HUMAN_RESOURCE
*/
var HUMAN_RESOURCE = HUMAN_RESOURCE || {};

/**
* @class JustClass
* @constructor
*/
HUMAN_RESOURCE.JustClass = function(){ }

/**
* Constructs Person objects
* @class Person
* @constructor
* @param {String} First name
* @param {String} Last name
*/
HUMAN_RESOURCE.Person = function (first, last) {    
    /**
    * First name of the Person
    * @property first_name
    * @type String
    */
    this.first_name = first;

    /**
    * @property f_createPerson
    * @param {Person} [_person] açıklama
    * @return {Person} Person type object
    */
    this.f_createPerson = function(_person, _person2){ return new Person() }
};

/**
* Return Person's full name
* @alias getName
* @memberof! HUMAN_RESOURCE.Person#
* @return {String} First name + last name
*/
HUMAN_RESOURCE.Person.prototype.getName = function () {
    return this.first_name + ' ' + this.last_name;
};
like image 248
uzay95 Avatar asked Apr 14 '15 08:04

uzay95


People also ask

How do I use JSDoc parameters in JavaScript?

The parameter type can be a built-in JavaScript type, such as stringor Object, or a JSDoc namepathto another symbol in your code. If you have written documentation for the symbol at that namepath, JSDoc will automatically link to the documentation for that symbol.

How do I link to JSDoc documentation for a symbol?

If you have written documentation for the symbol at that namepath, JSDoc will automatically link to the documentation for that symbol. You can also use a type expression to indicate, for example, that a parameter is not nullable or can accept any type; see the @typetag documentationfor details.

How do I add a JSDoc comment to a method?

To create a JSDoc comment Position the caret before the declaration of the method/function or field to document, type the opening block comment /**, and press Enter. Describe the listed parameters, return values, and so on. Alternatively, use the dedicated Fix Doc Comment action.

Is there a way to add JSDoc to a NPM script?

JSDoc is configurable, and of course you can place it in an NPM script for convenience. "I don't see any value in adding documentation to my code. Why should I bother?" I see where you're coming from! For typed languages like Java or TypeScript adding types to parameters in the documentation would be redundant.


1 Answers

Fortunately yes, it is just not always obvious what the correct name path is (but you can basically see it at the top of your generated docs)

/**
* @property f_createPerson
* @param {module:app~HUMAN_RESOURCE.Person} [_person] açıklama
* @return {module:app~HUMAN_RESOURCE.Person} Person type object
*/
this.f_createPerson = function(_person, _person2){ return new Person() }
like image 147
SGD Avatar answered Sep 22 '22 15:09

SGD