Skip to content
Rene Saarsoo edited this page May 28, 2013 · 8 revisions

Synopsis:

@inheritdoc
@inheritdoc ClassName
@inheritdoc #memberName
@inheritdoc ClassName#memberName
@inheritdoc ClassName#static-type-memberName

Provides means for copying documentation from another class or member.

For example you have documented a config option extensively in parent class:

/**
 * @cfg
 * Some very long documentation...
 */
shape: 'line',

But in subclass you want to change the default value of the config. Now it would be good if the documentation of subclass reflected this change, but you don't want to duplicate the long documentation again. That's where @inheritdoc steps in:

/**
 * @cfg
 * @inheritdoc
 */
shape: 'rectangle'

Another common use of @inheritdoc is defining an alias for some method. For example Ext.each is alias for Ext.Array.each. In such case specify the class and member to inherit:

/**
 * @member Ext
 * @method each
 * @inheritdoc Ext.Array#each
 */
Ext.each = Ext.Array.each

Or you can reference a member from the current class:

/**
 * @method each
 * @inheritdoc #forEach
 */

Finally as an odd case you can inherit from a different type of member:

/**
 * @method foo
 * @inheritdoc #event-bar
 */

The whole syntax of the reference following the @inheritdoc is the same as with @link tags.

See also @localdoc (only available in JSDuck 5.x).

Use of @alias as @inheritdoc

Old versions of JSDuck used @alias in place of @inheritdoc. Later @alias was re-purposed for documenting Ext4 class name aliases. For backwards compatibility the old way is still supported when the following form is used:

@alias ClassName#member

That is, @alias can't be followed by only class name or member name. For new code, always use @inheritdoc.

Clone this wiki locally