Skip to content

Commit 7b77981

Browse files
committed
Fix for PropertyBag
Improved EntityCluster description
1 parent 0042fe8 commit 7b77981

File tree

3 files changed

+18
-13
lines changed

3 files changed

+18
-13
lines changed

Source/DataSources/EntityCluster.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -963,9 +963,8 @@ EntityCluster.prototype.destroy = function () {
963963
* @callback EntityCluster.newClusterCallback
964964
*
965965
* @param {Entity[]} clusteredEntities An array of the entities contained in the cluster.
966-
* @param {Object} cluster An object
967-
* containing billboard, label, and point properties. The values are the same as
968-
* billboard, label and point entities, but must be the values of the ConstantProperty.
966+
* @param {Object} cluster An object containing the Billboard, Label, and Point
967+
* primitives that represent this cluster of entities.
969968
* @param {Billboard} cluster.billboard
970969
* @param {Label} cluster.label
971970
* @param {PointPrimitive} cluster.point

Source/DataSources/PropertyBag.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,12 @@ import Property from "./Property.js";
99
/**
1010
* A {@link Property} whose value is a key-value mapping of property names to the computed value of other properties.
1111
*
12-
* @typedef {PropertyBagType}
12+
* @alias PropertyBag
13+
* @constructor
14+
* @implements {DictionaryLike}
15+
*
16+
* @param {Object} [value] An object, containing key-value mapping of property names to properties.
17+
* @param {Function} [createPropertyCallback] A function that will be called when the value of any of the properties in value are not a Property.
1318
*/
1419
function PropertyBag(value, createPropertyCallback) {
1520
this._propertyNames = [];

gulpfile.cjs

+10-9
Original file line numberDiff line numberDiff line change
@@ -1550,6 +1550,12 @@ function createTypeScriptDefinitions() {
15501550
.replace(/<String>/gm, "<string>")
15511551
.replace(/<Boolean>/gm, "<boolean>")
15521552
.replace(/<Object>/gm, "<object>")
1553+
// The class has to be called PropertyBag for JSDoc purposes, but we can rename
1554+
// it and reuse the `PropertyBag` name for a union type, see below
1555+
.replace(
1556+
/export (class|interface) PropertyBag/gm,
1557+
"export $1 PropertyBagBase"
1558+
)
15531559
.replace(
15541560
/= "WebGLConstants\.(.+)"/gm,
15551561
(match, p1) => `= WebGLConstants.${p1}`
@@ -1562,19 +1568,14 @@ function createTypeScriptDefinitions() {
15621568
/**
15631569
* Private interfaces to support PropertyBag being a dictionary-like object.
15641570
*/
1571+
interface DictionaryLike {
1572+
[index: string]: any;
1573+
}
15651574
interface PropertyDictionary {
15661575
[key: string]: Property | undefined;
15671576
}
1568-
class PropertyBagBase {
1569-
readonly propertyNames: string[];
1570-
constructor(value?: object, createPropertyCallback?: Function);
1571-
addProperty(propertyName: string, value?: any, createPropertyCallback?: Function): void;
1572-
hasProperty(propertyName: string): boolean;
1573-
merge(source: Object, createPropertyCallback?: Function): void;
1574-
removeProperty(propertyName: string): void;
1575-
}
15761577
/** This has to be in the workaround section because JSDoc doesn't support Intersection Types */
1577-
type PropertyBagType = PropertyDictionary & Property & PropertyBagBase;
1578+
type PropertyBag = PropertyDictionary & Property & PropertyBagBase;
15781579
15791580
${source}
15801581
}

0 commit comments

Comments
 (0)