Skip to content

Commit ddfa74b

Browse files
s-rigaudSamuel Rigaud
and
Samuel Rigaud
authored
Docs: fix types (mrdoob#30677)
Co-authored-by: Samuel Rigaud <[email protected]>
1 parent ce5f72a commit ddfa74b

24 files changed

+43
-33
lines changed

examples/jsm/libs/motion-controllers.module.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ class MotionController {
338338
/**
339339
* @param {Object} xrInputSource - The XRInputSource to build the MotionController around
340340
* @param {Object} profile - The best matched profile description for the supplied xrInputSource
341-
* @param {Object} assetUrl
341+
* @param {string} assetUrl
342342
*/
343343
constructor(xrInputSource, profile, assetUrl) {
344344
if (!xrInputSource) {

examples/jsm/math/ConvexHull.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ class ConvexHull {
328328
*
329329
* @private
330330
* @param {Face} face - The target face.
331-
* @return {ConvexHull} A reference to this convex hull.
331+
* @return {VertexNode|undefined} A reference to this convex hull.
332332
*/
333333
_removeAllVerticesFromFace( face ) {
334334

@@ -1391,7 +1391,7 @@ class VertexNode {
13911391
* Reference to the previous vertex in the double linked list.
13921392
*
13931393
* @private
1394-
* @type {?Vector3}
1394+
* @type {?VertexNode}
13951395
* @default null
13961396
*/
13971397
this.prev = null;
@@ -1400,7 +1400,7 @@ class VertexNode {
14001400
* Reference to the next vertex in the double linked list.
14011401
*
14021402
* @private
1403-
* @type {?Vector3}
1403+
* @type {?VertexNode}
14041404
* @default null
14051405
*/
14061406
this.next = null;

examples/jsm/objects/MarchingCubes.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class MarchingCubes extends Mesh {
2222
* @param {Material} material - The cube's material.
2323
* @param {boolean} [enableUvs=false] - Whether texture coordinates should be animated or not.
2424
* @param {boolean} [enableColors=false] - Whether colors should be animated or not.
25-
* @param {boolean} [maxPolyCount=10000] - The maximum size of the geometry buffers.
25+
* @param {number} [maxPolyCount=10000] - The maximum size of the geometry buffers.
2626
*/
2727
constructor( resolution, material, enableUvs = false, enableColors = false, maxPolyCount = 10000 ) {
2828

examples/jsm/tsl/display/PixelationPassNode.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -234,8 +234,8 @@ class PixelationPassNode extends PassNode {
234234
* @param {Scene} scene - The scene to render.
235235
* @param {Camera} camera - The camera to render the scene with.
236236
* @param {Node<float> | number} [pixelSize=6] - The pixel size.
237-
* @param {Node<float> | number} [normalEdgeStrength=03] - The normal edge strength.
238-
* @param {Node<float> | number} [depthEdgeStrength=03] - The depth edge strength.
237+
* @param {Node<float> | number} [normalEdgeStrength=0.3] - The normal edge strength.
238+
* @param {Node<float> | number} [depthEdgeStrength=0.4] - The depth edge strength.
239239
*/
240240
constructor( scene, camera, pixelSize = 6, normalEdgeStrength = 0.3, depthEdgeStrength = 0.4 ) {
241241

@@ -324,8 +324,8 @@ class PixelationPassNode extends PassNode {
324324
* @param {Scene} scene - The scene to render.
325325
* @param {Camera} camera - The camera to render the scene with.
326326
* @param {Node<float> | number} [pixelSize=6] - The pixel size.
327-
* @param {Node<float> | number} [normalEdgeStrength=03] - The normal edge strength.
328-
* @param {Node<float> | number} [depthEdgeStrength=03] - The depth edge strength.
327+
* @param {Node<float> | number} [normalEdgeStrength=0.3] - The normal edge strength.
328+
* @param {Node<float> | number} [depthEdgeStrength=0.4] - The depth edge strength.
329329
* @returns {PixelationPassNode}
330330
*/
331331
export const pixelationPass = ( scene, camera, pixelSize, normalEdgeStrength, depthEdgeStrength ) => nodeObject( new PixelationPassNode( scene, camera, pixelSize, normalEdgeStrength, depthEdgeStrength ) );

examples/jsm/utils/BufferGeometryUtils.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ function computeMikkTSpaceTangents( geometry, MikkTSpace, negateSign = true ) {
102102
/**
103103
* @param {Array<BufferGeometry>} geometries
104104
* @param {boolean} useGroups
105-
* @return {BufferGeometry}
105+
* @return {?BufferGeometry}
106106
*/
107107
function mergeGeometries( geometries, useGroups = false ) {
108108

@@ -297,7 +297,7 @@ function mergeGeometries( geometries, useGroups = false ) {
297297

298298
/**
299299
* @param {Array<BufferAttribute>} attributes
300-
* @return {BufferAttribute}
300+
* @return {?BufferAttribute}
301301
*/
302302
function mergeAttributes( attributes ) {
303303

examples/jsm/utils/GeometryUtils.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { Vector3 } from 'three';
1414
* @param {number} [v1=1] - Corner index -X, +Z.
1515
* @param {number} [v2=2] - Corner index +X, +Z.
1616
* @param {number} [v3=3] - Corner index +X, -Z.
17-
* @returns {Array<Array<number>>} The Hilbert curve points.
17+
* @returns {Array<Vector3>} The Hilbert curve points.
1818
*/
1919
function hilbert2D( center = new Vector3( 0, 0, 0 ), size = 10, iterations = 1, v0 = 0, v1 = 1, v2 = 2, v3 = 3 ) {
2020

@@ -68,7 +68,7 @@ function hilbert2D( center = new Vector3( 0, 0, 0 ), size = 10, iterations = 1,
6868
* @param {number} [v5=5] - Corner index +X, -Y, +Z.
6969
* @param {number} [v6=6] - Corner index +X, +Y, +Z.
7070
* @param {number} [v7=7] - Corner index +X, +Y, -Z.
71-
* @returns {Array<Array<number>>} - The Hilbert curve points.
71+
* @returns {Array<Vector3>} - The Hilbert curve points.
7272
*/
7373
function hilbert3D( center = new Vector3( 0, 0, 0 ), size = 10, iterations = 1, v0 = 0, v1 = 1, v2 = 2, v3 = 3, v4 = 4, v5 = 5, v6 = 6, v7 = 7 ) {
7474

src/animation/AnimationUtils.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ function sortedArray( values, stride, order ) {
9393
* @param {Array<number>} jsonKeys - A list of JSON keyframes.
9494
* @param {Array<number>} times - This array will be filled with keyframe times by this function.
9595
* @param {Array<number>} values - This array will be filled with keyframe values by this function.
96-
* @param {Object<string, any>} valuePropertyName - A dictionary assigning values to property names.
96+
* @param {string} valuePropertyName - The name of the property to use.
9797
*/
9898
function flattenJSON( jsonKeys, times, values, valuePropertyName ) {
9999

@@ -451,7 +451,7 @@ class AnimationUtils {
451451
* @param {Array<number>} jsonKeys - A list of JSON keyframes.
452452
* @param {Array<number>} times - This array will be filled with keyframe times by this method.
453453
* @param {Array<number>} values - This array will be filled with keyframe values by this method.
454-
* @param {Object<string, any>} valuePropertyName - A dictionary assigning values to property names.
454+
* @param {string} valuePropertyName - The name of the property to use.
455455
*/
456456
static flattenJSON( jsonKeys, times, values, valuePropertyName ) {
457457

src/constants.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export const MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2, ROTATE: 0, DOLLY: 1, PAN: 2
1111
/**
1212
* Represents touch interaction types in context of controls.
1313
*
14-
* @type {ConstantsMouse}
14+
* @type {ConstantsTouch}
1515
* @constant
1616
*/
1717
export const TOUCH = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 };

src/core/BufferAttribute.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ class BufferAttribute {
9292
* `0.0f - +1.0f` in the GLSL attribute. If `normalized` is `false`, the values will be converted
9393
* to floats unmodified, i.e. `65535` becomes `65535.0f`.
9494
*
95-
* @type {number}
95+
* @type {boolean}
9696
*/
9797
this.normalized = normalized;
9898

src/extras/core/Curve.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ class Curve {
6262
* @abstract
6363
* @param {number} t - A interpolation factor representing a position on the curve. Must be in the range `[0,1]`.
6464
* @param {(Vector2|Vector3)} [optionalTarget] - The optional target vector the result is written to.
65-
* @return {?(Vector2|Vector3)} The position on the curve. It can be a 2D or 3D vector depending on the curve definition.
65+
* @return {(Vector2|Vector3)} The position on the curve. It can be a 2D or 3D vector depending on the curve definition.
6666
*/
6767
getPoint( /* t, optionalTarget */ ) {
6868

src/geometries/LatheGeometry.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class LatheGeometry extends BufferGeometry {
2525
/**
2626
* Constructs a new lathe geometry.
2727
*
28-
* @param {Array<Vector2>} [points] - An array of points in 2D space. The x-coordinate of each point
28+
* @param {Array<Vector2|Vector3>} [points] - An array of points in 2D space. The x-coordinate of each point
2929
* must be greater than zero.
3030
* @param {number} [segments=12] - The number of circumference segments to generate.
3131
* @param {number} [phiStart=0] - The starting angle in radians.

src/math/Color.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,7 @@ class Color {
559559
* Converts the colors RGB values into the HSL format and stores them into the
560560
* given target object.
561561
*
562-
* @param {{h:0,s:0,l:0}} target - The target object that is used to store the method's result.
562+
* @param {{h:number,s:number,l:number}} target - The target object that is used to store the method's result.
563563
* @param {string} [colorSpace=ColorManagement.workingColorSpace] - The color space.
564564
* @return {{h:number,s:number,l:number}} The HSL representation of this color.
565565
*/

src/nodes/accessors/ReferenceNode.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ export default ReferenceNode;
388388
* @function
389389
* @param {string} name - The name of the property the node refers to.
390390
* @param {string} type - The uniform type that should be used to represent the property value.
391-
* @param {?Object} object - The object the property belongs to.
391+
* @param {?Object} [object] - The object the property belongs to.
392392
* @returns {ReferenceNode}
393393
*/
394394
export const reference = ( name, type, object ) => nodeObject( new ReferenceNode( name, type, object ) );

src/nodes/accessors/UniformArrayNode.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ export default UniformArrayNode;
342342
* @tsl
343343
* @function
344344
* @param {Array<any>} values - Array-like data.
345-
* @param {?string} nodeType - The data type of the array elements.
345+
* @param {?string} [nodeType] - The data type of the array elements.
346346
* @returns {UniformArrayNode}
347347
*/
348348
export const uniformArray = ( values, nodeType ) => nodeObject( new UniformArrayNode( values, nodeType ) );

src/nodes/core/CacheNode.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ export default CacheNode;
9292
* @tsl
9393
* @function
9494
* @param {Node} node - The node that should be cached.
95-
* @param {boolean} parent - Whether this node refers to a shared parent cache or not.
95+
* @param {boolean} [parent] - Whether this node refers to a shared parent cache or not.
9696
* @returns {CacheNode}
9797
*/
9898
export const cache = ( node, parent ) => nodeObject( new CacheNode( nodeObject( node ), parent ) );

src/nodes/core/NodeBuilder.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -314,8 +314,10 @@ class NodeBuilder {
314314
/**
315315
* This dictionary holds the node variables of this builder.
316316
* The variables are maintained in an array for each shader stage.
317+
* This dictionary is also used to count the number of variables
318+
* according to their type (const, vars).
317319
*
318-
* @type {Object<string,Array<NodeVar>>}
320+
* @type {Object<string,Array<NodeVar>|number>}
319321
*/
320322
this.vars = {};
321323

src/nodes/lighting/AnalyticLightNode.js

+8
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,17 @@ class AnalyticLightNode extends LightingNode {
128128
*
129129
* @abstract
130130
* @param {NodeBuilder} builder - The builder object used for setting up the light.
131+
* @return {Object|undefined} The direct light data (color and direction).
131132
*/
132133
setupDirect( /*builder*/ ) { }
133134

135+
/**
136+
* Sets up the direct rect area lighting for the analytic light node.
137+
*
138+
* @abstract
139+
* @param {NodeBuilder} builder - The builder object used for setting up the light.
140+
* @return {Object|undefined} The direct rect area light data.
141+
*/
134142
setupDirectRectArea( /*builder*/ ) { }
135143

136144
/**

src/nodes/lighting/ShadowNode.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -806,7 +806,7 @@ export default ShadowNode;
806806
* @tsl
807807
* @function
808808
* @param {Light} light - The shadow casting light.
809-
* @param {LightShadow} shadow - The light shadow.
809+
* @param {?LightShadow} [shadow] - The light shadow.
810810
* @return {ShadowNode} The created shadow node.
811811
*/
812812
export const shadow = ( light, shadow ) => nodeObject( new ShadowNode( light, shadow ) );

src/objects/InstancedMesh.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ class InstancedMesh extends Mesh {
7171
* {@link Texture#needsUpdate} flag to true if you modify instanced data
7272
* via {@link InstancedMesh#setMorphAt}.
7373
*
74-
* @type {?InstancedBufferAttribute}
74+
* @type {?DataTexture}
7575
* @default null
7676
*/
7777
this.morphTexture = null;

src/objects/Skeleton.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ class Skeleton {
310310
* Setups the skeleton by the given JSON and bones.
311311
*
312312
* @param {Object} json - The skeleton as serialized JSON.
313-
* @param {Array<Bone>} bones - An array of bones.
313+
* @param {Object<string, Bone>} bones - An array of bones.
314314
* @return {Skeleton} A reference of this instance.
315315
*/
316316
fromJSON( json, bones ) {

src/renderers/common/Animation.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ class Animation {
103103
/**
104104
* Defines the user-level animation loop.
105105
*
106-
* @param {Function} callback - The animation loop.
106+
* @param {?Function} callback - The animation loop.
107107
*/
108108
setAnimationLoop( callback ) {
109109

src/renderers/common/Renderer.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1510,7 +1510,7 @@ class Renderer {
15101510
* for best compatibility.
15111511
*
15121512
* @async
1513-
* @param {Function} callback - The application's animation loop.
1513+
* @param {?Function} callback - The application's animation loop.
15141514
* @return {Promise} A Promise that resolves when the set has been executed.
15151515
*/
15161516
async setAnimationLoop( callback ) {

src/renderers/common/XRManager.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ class XRManager extends EventDispatcher {
229229
* The current XR reference space type.
230230
*
231231
* @private
232-
* @type {string}
232+
* @type {XRReferenceSpaceType}
233233
* @default 'local-floor'
234234
*/
235235
this._referenceSpaceType = 'local-floor';
@@ -439,7 +439,7 @@ class XRManager extends EventDispatcher {
439439
/**
440440
* Returns the reference space type.
441441
*
442-
* @return {string} The reference space type.
442+
* @return {XRReferenceSpaceType} The reference space type.
443443
*/
444444
getReferenceSpaceType() {
445445

@@ -452,7 +452,7 @@ class XRManager extends EventDispatcher {
452452
*
453453
* This method can not be used during a XR session.
454454
*
455-
* @param {string} type - The reference space type.
455+
* @param {XRReferenceSpaceType} type - The reference space type.
456456
*/
457457
setReferenceSpaceType( type ) {
458458

src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ class GLSLNodeBuilder extends NodeBuilder {
7979
* An array that holds objects defining the varying and attribute data in
8080
* context of Transform Feedback.
8181
*
82-
* @type {Object<string,Map<string,Object>>}
82+
* @type {Array<Object<string,AttributeNode|string>>}
8383
*/
8484
this.transforms = [];
8585

0 commit comments

Comments
 (0)