website/docgen/processors/add-links.js
function(param) {
  var str = param.typeExpression;
  var type = param.type;
  if (!type) {
    return escape(str);
  }

  var replaceWithLinkIfPresent = function(type) {
    if (type.name) {
      str = str.replace(type.name, toMarkdownLinkFormat(type.name));
    }
  };

  if (type.type === 'FunctionType') {
    _.each(type.params, replaceWithLinkIfPresent);
  } else if (type.type === 'TypeApplication') {
    // Is this an Array.<type>?
    var match = str.match(/Array\.<(.*)>/);
    if (match) {
      var typeInsideArray = match[1];
      str = str.replace(typeInsideArray, toMarkdownLinkFormat(typeInsideArray));
    }
  } else if (type.type === 'NameExpression') {
    replaceWithLinkIfPresent(type);
  }

  return escape(str);
}
function(param) {
  var str = param.typeExpression;
  var type = param.type;
  if (!type) {
    return escape(str);
  }

  var replaceWithLinkIfPresent = function(type) {
    if (type.name) {
      str = str.replace(type.name, toMarkdownLinkFormat(type.name));
    }
  };

  if (type.type === 'FunctionType') {
    _.each(type.params, replaceWithLinkIfPresent);
  } else if (type.type === 'TypeApplication') {
    // Is this an Array.<type>?
    var match = str.match(/Array\.<(.*)>/);
    if (match) {
      var typeInsideArray = match[1];
      str = str.replace(typeInsideArray, toMarkdownLinkFormat(typeInsideArray));
    }
  } else if (type.type === 'NameExpression') {
    replaceWithLinkIfPresent(type);
  }

  return escape(str);
}
function ( param ) { var str = param . typeExpression ; var type = param . type ; if ( ! type ) { return escape ( str ) ; } var replaceWithLinkIfPresent = function ( type ) { if ( type . name ) { str = str . replace ( type . name , toMarkdownLinkFormat ( type . name ) ) ; } } ; if ( type . type === 'FunctionType' ) { _ . each ( type . params , replaceWithLinkIfPresent ) ; } else if ( type . type === 'TypeApplication' ) { // Is this an Array.<type>? var match = str . match ( / Array\.<(.*)> / ) ; if ( match ) { var typeInsideArray = match [ 1 ] ; str = str . replace ( typeInsideArray , toMarkdownLinkFormat ( typeInsideArray ) ) ; } } else if ( type . type === 'NameExpression' ) { replaceWithLinkIfPresent ( type ) ; } return escape ( str ) ; }
Create the param or return type.
@param {!Object} param Parameter.
@return {string} Escaped param string with links to the types.
Create the param or return type .