Add support for jsdoc typedef
MODIFY
jsdoc.conf.json
jsdoc.conf.json
},
"plugins": [
"jsdoc/plugins/events",
+ "jsdoc/plugins/typedef_augments",
"node_modules/jsdoc-autoprivate/autoprivate.js",
"plugins/markdown"
],

ADD
jsdoc/plugins/typedef_augments.js
+/**
+ * Define a jsdoc plugin to update typedefs that use augments.
+ */
+exports.handlers = {
+ /**
+ * Modify typedefs that use augments (extends). Add the base typedef's
+ * properties to the augmented typedefs.
+ */
+ parseComplete: function (e) {
+ var typedefs = {},
+ augmentedTypedefs = {},
+ numAugmented = 0;
+ /* Make a dictionary of all known typedefs and a dictionary of augmented
+ * typedefs */
+ e.doclets.forEach(function (doclet) {
+ if (doclet.kind === 'typedef') {
+ typedefs[doclet.longname] = doclet;
+ if (doclet.augments && doclet.augments.length) {
+ augmentedTypedefs[doclet.longname] = doclet;
+ }
+ }
+ });
+ while (Object.keys(augmentedTypedefs).length !== numAugmented) {
+ numAugmented = Object.keys(augmentedTypedefs).length;
+ Object.keys(augmentedTypedefs).forEach(function (name) {
+ var doclet = augmentedTypedefs[name];
+ /* If this typedef is augmented by an augmented typedef, skip it for
+ * now. Ignore self references */
+ if (doclet.augments.some(function (augmentName) {
+ return augmentName !== name && augmentedTypedefs[augmentName];
+ })) {
+ return;
+ }
+ /* Ensure we have properties */
+ doclet.properties = doclet.properties || [];
+ /* Make a dictionary so we don't clobber known properties. */
+ var properties = {};
+ doclet.properties.forEach(function (prop) {
+ properties[prop.name] = prop;
+ });
+ /* For each augment base, add its properties if we don't already have
+ * them. If the typedef augments two other typedefs that each have a
+ * property of the same name, the last listed will be shown (done by
+ * reversing the augments list). */
+ doclet.augments.slice().reverse().forEach(function (augmentName) {
+ if (augmentName !== name && typedefs[augmentName] && typedefs[augmentName].properties) {
+ typedefs[augmentName].properties.forEach(function (prop) {
+ if (!properties[prop.name]) {
+ /* Make a copy so we don't mutate the original property. */
+ prop = Object.assign(prop);
+ /* Add a value that a rendering template could use to show that
+ * the property was inherted from a parent. Since that in turn
+ * could have been inherited, preserve a known value. */
+ prop.inherited = prop.inherited || augmentName;
+ /* Add the property to the typedef and to the list of known
+ * properties. */
+ doclet.properties.push(prop);
+ properties[prop.name] = prop;
+ }
+ });
+ }
+ });
+ /* We've finished processing this typedef, so remove it from the
+ * augmented list. */
+ delete augmentedTypedefs[name];
+ });
+ }
+ }
+};

MODIFY
src/annotation.js
src/annotation.js
@@ -1074,9 +1074,10 @@ var annotation = function (type, args) {
};
/**
- * Rectangle annotation specification.
+ * Rectangle annotation specification. Extends {@link geo.annotation.spec}.
*
- * @typedef {geo.annotation.spec} geo.rectangleAnnotation.spec
+ * @typedef {object} geo.rectangleAnnotation.spec
+ * @extends geo.annotation.spec
* @property {geo.geoPosition[]} [corners] A list of four corners in map gcs
* coordinates. These must be in order around the perimeter of the
* rectangle (in either direction).
@@ -1460,9 +1461,10 @@ rectangleRequiredFeatures[polygonFeature.capabilities.feature] = true;
registerAnnotation('rectangle', rectangleAnnotation, rectangleRequiredFeatures);
/**
- * Polygon annotation specification.
+ * Polygon annotation specification. Extends {@link geo.annotation.spec}.
*
- * @typedef {geo.annotation.spec} geo.polygonAnnotation.spec
+ * @typedef {object} geo.polygonAnnotation.spec
+ * @extends geo.annotation.spec
* @property {geo.geoPosition[]} [vertices] A list of vertices in map gcs
* coordinates. These must be in order around the perimeter of the polygon
* (in either direction).
@@ -1725,9 +1727,10 @@ polygonRequiredFeatures[lineFeature.capabilities.basic] = [annotationState.creat
registerAnnotation('polygon', polygonAnnotation, polygonRequiredFeatures);
/**
- * Line annotation specification.
+ * Line annotation specification. Extends {@link geo.annotation.spec}.
*
- * @typedef {geo.annotation.spec} geo.lineAnnotation.spec
+ * @typedef {object} geo.lineAnnotation.spec
+ * @extends geo.annotation.spec
* @property {geo.geoPosition[]} [vertices] A list of vertices in map gcs
* coordinates.
* @property {geo.geoPosition[]} [coordinates] An alternate name for
@@ -2110,9 +2113,10 @@ lineRequiredFeatures[lineFeature.capabilities.basic] = [annotationState.create];
registerAnnotation('line', lineAnnotation, lineRequiredFeatures);
/**
- * Point annotation specification.
+ * Point annotation specification. Extends {@link geo.annotation.spec}.
*
- * @typedef {geo.annotation.spec} geo.pointAnnotation.spec
+ * @typedef {object} geo.pointAnnotation.spec
+ * @extends geo.annotation.spec
* @property {geo.geoPosition} [position] A coordinate in map gcs coordinates.
* @property {geo.geoPosition[]} [coordinates] An array with one coordinate to
* use in place of `position`.

Add support for jsdoc typedef @augments/@extends.