Browse Source

Types: fix generic types (#31773)

Co-authored-by: Samuel Rigaud <rigaud@gmail.com>
Samuel Rigaud 4 months ago
parent
commit
5b6f5ebb44

+ 2 - 2
examples/jsm/math/Lut.js

@@ -45,7 +45,7 @@ class Lut {
 		/**
 		 * The currently selected color map.
 		 *
-		 * @type {Array}
+		 * @type {Array<Array<number>>}
 		 */
 		this.map = [];
 
@@ -219,7 +219,7 @@ class Lut {
 	 * Adds a color map to this Lut instance.
 	 *
 	 * @param {string} name - The name of the color map.
-	 * @param {Array} arrayOfColors - An array of color values. Each value is an array
+	 * @param {Array<Array<number>>} arrayOfColors - An array of color values. Each value is an array
 	 * holding a threshold and the actual color value as a hexadecimal number.
 	 * @return {Lut} A reference to this LUT.
 	 */

+ 1 - 1
examples/jsm/misc/Volume.js

@@ -234,7 +234,7 @@ class Volume {
 		/**
 		 * The list of all the slices associated to this volume
 		 *
-		 * @type {Array}
+		 * @type {Array<VolumeSlice>}
 		 */
 		this.sliceList = [];
 

+ 2 - 2
examples/jsm/tsl/display/OutlineNode.js

@@ -56,7 +56,7 @@ class OutlineNode extends TempNode {
 	 * @param {Scene} scene - A reference to the scene.
 	 * @param {Camera} camera - The camera the scene is rendered with.
 	 * @param {Object} params - The configuration parameters.
-	 * @param {Array<Object3D>} params.selectedObjects - An array of selected objects.
+	 * @param {Array<Object3D>} [params.selectedObjects] - An array of selected objects.
 	 * @param {Node<float>} [params.edgeThickness=float(1)] - The thickness of the edges.
 	 * @param {Node<float>} [params.edgeGlow=float(0)] - Can be used for an animated glow/pulse effects.
 	 * @param {number} [params.downSampleRatio=2] - The downsample ratio.
@@ -742,7 +742,7 @@ export default OutlineNode;
  * @param {Scene} scene - A reference to the scene.
  * @param {Camera} camera - The camera the scene is rendered with.
  * @param {Object} params - The configuration parameters.
- * @param {Array<Object3D>} params.selectedObjects - An array of selected objects.
+ * @param {Array<Object3D>} [params.selectedObjects] - An array of selected objects.
  * @param {Node<float>} [params.edgeThickness=float(1)] - The thickness of the edges.
  * @param {Node<float>} [params.edgeGlow=float(0)] - Can be used for animated glow/pulse effects.
  * @param {number} [params.downSampleRatio=2] - The downsample ratio.

+ 1 - 1
src/materials/nodes/manager/NodeMaterialObserver.js

@@ -548,7 +548,7 @@ class NodeMaterialObserver {
 	 *
 	 * @param {LightsNode} lightsNode - The lights node.
 	 * @param {number} renderId - The render ID.
-	 * @return {Array} The lights for the given lights node and render ID.
+	 * @return {Array<Object>} The lights for the given lights node and render ID.
 	 */
 	getLights( lightsNode, renderId ) {
 

+ 1 - 1
src/nodes/accessors/BufferNode.js

@@ -93,7 +93,7 @@ export default BufferNode;
  *
  * @tsl
  * @function
- * @param {Array} value - Array-like buffer data.
+ * @param {Array<number>} value - Array-like buffer data.
  * @param {string} type - The data type of a buffer element.
  * @param {number} count - The count of buffer elements.
  * @returns {BufferNode}

+ 1 - 1
src/nodes/core/NodeBuilder.js

@@ -2655,7 +2655,7 @@ class NodeBuilder {
 	/**
 	 * Returns the closest sub-build layer for the given data.
 	 *
-	 * @param {Node|Set|Array} data - The data to get the closest sub-build layer from.
+	 * @param {Node|Set<string>|Array<string>} data - The data to get the closest sub-build layer from.
 	 * @return {?string} The closest sub-build name or null if none found.
 	 */
 	getClosestSubBuild( data ) {

+ 1 - 1
src/nodes/core/NodeFrame.js

@@ -115,7 +115,7 @@ class NodeFrame {
 	 * @private
 	 * @param {WeakMap<Node, Object>} referenceMap - The reference weak map.
 	 * @param {Node} nodeRef - The reference to the current node.
-	 * @return {Object<string,WeakMap>} The dictionary.
+	 * @return {Object<string,WeakMap<Object, number>>} The dictionary.
 	 */
 	_getMaps( referenceMap, nodeRef ) {
 

+ 1 - 1
src/renderers/common/Backend.js

@@ -38,7 +38,7 @@ class Backend {
 		 * This weak map holds backend-specific data of objects
 		 * like textures, attributes or render targets.
 		 *
-		 * @type {WeakMap}
+		 * @type {WeakMap<Object, Object>}
 		 */
 		this.data = new WeakMap();
 

+ 1 - 1
src/renderers/common/ChainMap.js

@@ -16,7 +16,7 @@ class ChainMap {
 		/**
 		 * The root Weak Map.
 		 *
-		 * @type {WeakMap}
+		 * @type {WeakMap<Object, WeakMap>}
 		 */
 		this.weakMap = new WeakMap();
 

+ 1 - 1
src/renderers/common/DataMap.js

@@ -15,7 +15,7 @@ class DataMap {
 		 * `DataMap` internally uses a weak map
 		 * to manage its data.
 		 *
-		 * @type {WeakMap}
+		 * @type {WeakMap<Object, Object>}
 		 */
 		this.data = new WeakMap();
 

+ 1 - 1
src/renderers/common/Pipelines.js

@@ -58,7 +58,7 @@ class Pipelines extends DataMap {
 		 * fragment and compute) the programmable stage objects which
 		 * represent the actual shader code.
 		 *
-		 * @type {Object<string,Map>}
+		 * @type {Object<string,Map<string, ProgrammableStage>>}
 		 */
 		this.programs = {
 			vertex: new Map(),

+ 5 - 5
src/renderers/common/nodes/NodeLibrary.js

@@ -146,9 +146,9 @@ class NodeLibrary {
 	/**
 	 * Adds a node class definition for the given type to the provided type library.
 	 *
-	 * @param {any} nodeClass - The node class definition.
+	 * @param {Node.constructor} nodeClass - The node class definition.
 	 * @param {number|string} type - The object type.
-	 * @param {Map} library - The type library.
+	 * @param {Map<number|string,Node.constructor>} library - The type library.
 	 */
 	addType( nodeClass, type, library ) {
 
@@ -169,9 +169,9 @@ class NodeLibrary {
 	/**
 	 * Adds a node class definition for the given class definition to the provided type library.
 	 *
-	 * @param {any} nodeClass - The node class definition.
-	 * @param {any} baseClass - The class definition.
-	 * @param {WeakMap} library - The type library.
+	 * @param {Node.constructor} nodeClass - The node class definition.
+	 * @param {Node.constructor} baseClass - The class definition.
+	 * @param {WeakMap<Node.constructor, Node.constructor>} library - The type library.
 	 */
 	addClass( nodeClass, baseClass, library ) {
 

粤ICP备19079148号