Skip to content

Commit d995617

Browse files
authored
Docs: Document nullable types according to JSDoc spec. (#30466)
* Docs: Document nullable types according to JSDoc spec. * Clean up.
1 parent 4f3c02b commit d995617

File tree

138 files changed

+613
-608
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

138 files changed

+613
-608
lines changed

examples/jsm/controls/ArcballControls.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ class ArcballControls extends Controls {
7979
/**
8080
*
8181
* @param {Camera} camera Virtual camera used in the scene
82-
* @param {HTMLElement?} [domElement=null] Renderer's dom element
83-
* @param {Scene?} [scene=null] The scene to be rendered
82+
* @param {?HTMLElement} [domElement=null] Renderer's dom element
83+
* @param {?Scene} [scene=null] The scene to be rendered
8484
*/
8585
constructor( camera, domElement = null, scene = null ) {
8686

@@ -1250,7 +1250,7 @@ class ArcballControls extends Controls {
12501250
* Get the operation associated to mouse and key combination and returns the corresponding FSA state
12511251
* @param {0|1|2} mouse Mouse button index (0, 1, 2)
12521252
* @param {'CTRL'|'SHIFT'|null} key Keyboard modifier
1253-
* @returns {STATE?} The FSA state obtained from the operation associated to mouse/keyboard combination
1253+
* @returns {?STATE} The FSA state obtained from the operation associated to mouse/keyboard combination
12541254
*/
12551255
getOpStateFromAction( mouse, key ) {
12561256

@@ -2328,7 +2328,7 @@ class ArcballControls extends Controls {
23282328
*
23292329
* @param {Vector2} cursor Cursor coordinates in NDC
23302330
* @param {Camera} camera Virtual camera
2331-
* @returns {Vector3?} The point of intersection with the model, if exist, null otherwise
2331+
* @returns {?Vector3} The point of intersection with the model, if exist, null otherwise
23322332
*/
23332333
unprojectOnObj( cursor, camera ) {
23342334

examples/jsm/exporters/GLTFExporter.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -987,11 +987,11 @@ class GLTFWriter {
987987

988988
/**
989989
* Process and generate a BufferView
990-
* @param {BufferAttribute} attribute
991-
* @param {number} componentType
992-
* @param {number} start
993-
* @param {number} count
994-
* @param {number?} target Target usage of the BufferView
990+
* @param {BufferAttribute} attribute
991+
* @param {number} componentType
992+
* @param {number} start
993+
* @param {number} count
994+
* @param {?number} target Target usage of the BufferView
995995
* @return {Object}
996996
*/
997997
processBufferView( attribute, componentType, start, count, target ) {
@@ -1179,11 +1179,11 @@ class GLTFWriter {
11791179

11801180
/**
11811181
* Process attribute to generate an accessor
1182-
* @param {BufferAttribute} attribute Attribute to process
1183-
* @param {THREE.BufferGeometry?} geometry Geometry used for truncated draw range
1184-
* @param {number} [start=0]
1185-
* @param {number} [count=Infinity]
1186-
* @return {number?} Index of the processed accessor on the "accessors" array
1182+
* @param {BufferAttribute} attribute Attribute to process
1183+
* @param {?BufferGeometry} geometry Geometry used for truncated draw range
1184+
* @param {number} [start=0]
1185+
* @param {number} [count=Infinity]
1186+
* @return {?number} Index of the processed accessor on the "accessors" array
11871187
*/
11881188
processAccessor( attribute, geometry, start, count ) {
11891189

examples/jsm/loaders/KTX2Loader.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ class KTX2Loader extends Loader {
324324

325325
/**
326326
* @param {ArrayBuffer} buffer
327-
* @param {object?} config
327+
* @param {?Object} config
328328
* @return {Promise<CompressedTexture|CompressedArrayTexture|DataTexture|Data3DTexture>}
329329
*/
330330
async _createTexture( buffer, config = {} ) {

examples/jsm/math/OBB.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ class OBB {
322322
*
323323
* @param {Ray} ray
324324
* @param {Vector3} result
325-
* @return {Vector3?}
325+
* @return {?Vector3}
326326
*/
327327
intersectRay( ray, result ) {
328328

examples/jsm/tsl/display/BloomNode.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,15 +154,15 @@ class BloomNode extends TempNode {
154154
* The material for the composite pass.
155155
*
156156
* @private
157-
* @type {NodeMaterial?}
157+
* @type {?NodeMaterial}
158158
*/
159159
this._compositeMaterial = null;
160160

161161
/**
162162
* The material for the luminance pass.
163163
*
164164
* @private
165-
* @type {NodeMaterial?}
165+
* @type {?NodeMaterial}
166166
*/
167167
this._highPassFilterMaterial = null;
168168

examples/jsm/tsl/display/DenoiseNode.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class DenoiseNode extends TempNode {
2525
*
2626
* @param {TextureNode} textureNode - The texture node that represents the input of the effect (e.g. AO).
2727
* @param {Node<float>} depthNode - A node that represents the scene's depth.
28-
* @param {Node<vec3>?} normalNode - A node that represents the scene's normals.
28+
* @param {?Node<vec3>} normalNode - A node that represents the scene's normals.
2929
* @param {Camera} camera - The camera the scene is rendered with.
3030
*/
3131
constructor( textureNode, depthNode, normalNode, camera ) {
@@ -51,7 +51,7 @@ class DenoiseNode extends TempNode {
5151
* constructor (because MRT is not available), normals can be automatically
5252
* reconstructed from depth values in the shader.
5353
*
54-
* @type {Node<vec3>?}
54+
* @type {?Node<vec3>}
5555
*/
5656
this.normalNode = normalNode;
5757

@@ -325,7 +325,7 @@ function generateDefaultNoise( size = 64 ) {
325325
* @function
326326
* @param {Node} node - The node that represents the input of the effect (e.g. AO).
327327
* @param {Node<float>} depthNode - A node that represents the scene's depth.
328-
* @param {Node<vec3>?} normalNode - A node that represents the scene's normals.
328+
* @param {?Node<vec3>} normalNode - A node that represents the scene's normals.
329329
* @param {Camera} camera - The camera the scene is rendered with.
330330
* @returns {DenoiseNode}
331331
*/

examples/jsm/tsl/display/FilmNode.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ class FilmNode extends TempNode {
1818
* Constructs a new film node.
1919
*
2020
* @param {Node} inputNode - The node that represents the input of the effect.
21-
* @param {Node<float>?} [intensityNode=null] - A node that represents the effect's intensity.
22-
* @param {Node<vec2>?} [uvNode=null] - A node that allows to pass custom (e.g. animated) uv data.
21+
* @param {?Node<float>} [intensityNode=null] - A node that represents the effect's intensity.
22+
* @param {?Node<vec2>} [uvNode=null] - A node that allows to pass custom (e.g. animated) uv data.
2323
*/
2424
constructor( inputNode, intensityNode = null, uvNode = null ) {
2525

@@ -35,14 +35,16 @@ class FilmNode extends TempNode {
3535
/**
3636
* A node that represents the effect's intensity.
3737
*
38-
* @type {Node<float>}
38+
* @type {?Node<float>}
39+
* @default null
3940
*/
4041
this.intensityNode = intensityNode;
4142

4243
/**
4344
* A node that allows to pass custom (e.g. animated) uv data.
4445
*
45-
* @type {Node<vec2>}
46+
* @type {?Node<vec2>}
47+
* @default null
4648
*/
4749
this.uvNode = uvNode;
4850

@@ -91,8 +93,8 @@ export default FilmNode;
9193
* @tsl
9294
* @function
9395
* @param {Node<vec4>} inputNode - The node that represents the input of the effect.
94-
* @param {Node<float>?} [intensityNode=null] - A node that represents the effect's intensity.
95-
* @param {Node<vec2>?} [uvNode=null] - A node that allows to pass custom (e.g. animated) uv data.
96+
* @param {?Node<float>} [intensityNode=null] - A node that represents the effect's intensity.
97+
* @param {?Node<vec2>} [uvNode=null] - A node that allows to pass custom (e.g. animated) uv data.
9698
* @returns {FilmNode}
9799
*/
98100
export const film = /*@__PURE__*/ nodeProxy( FilmNode );

examples/jsm/tsl/display/GTAONode.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class GTAONode extends TempNode {
4242
* Constructs a new GTAO node.
4343
*
4444
* @param {Node<float>} depthNode - A node that represents the scene's depth.
45-
* @param {Node<vec3>?} normalNode - A node that represents the scene's normals.
45+
* @param {?Node<vec3>} normalNode - A node that represents the scene's normals.
4646
* @param {Camera} camera - The camera the scene is rendered with.
4747
*/
4848
constructor( depthNode, normalNode, camera ) {
@@ -61,7 +61,7 @@ class GTAONode extends TempNode {
6161
* constructor (because MRT is not available), normals can be automatically
6262
* reconstructed from depth values in the shader.
6363
*
64-
* @type {Node<vec3>?}
64+
* @type {?Node<vec3>}
6565
*/
6666
this.normalNode = normalNode;
6767

@@ -514,7 +514,7 @@ function generateMagicSquare( size ) {
514514
* @tsl
515515
* @function
516516
* @param {Node<float>} depthNode - A node that represents the scene's depth.
517-
* @param {Node<vec3>?} normalNode - A node that represents the scene's normals.
517+
* @param {?Node<vec3>} normalNode - A node that represents the scene's normals.
518518
* @param {Camera} camera - The camera the scene is rendered with.
519519
* @returns {GTAONode}
520520
*/

examples/jsm/tsl/display/SSAAPassNode.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ class SSAAPassNode extends PassNode {
8888
* Reference to the internal render target that holds the current sample.
8989
*
9090
* @private
91-
* @type {RenderTarget?}
91+
* @type {?RenderTarget}
92+
* @default null
9293
*/
9394
this._sampleRenderTarget = null;
9495

examples/jsm/tsl/display/TRAAPassNode.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,15 +90,17 @@ class TRAAPassNode extends PassNode {
9090
* The render target that holds the current sample.
9191
*
9292
* @private
93-
* @type {RenderTarget?}
93+
* @type {?RenderTarget}
94+
* @default null
9495
*/
9596
this._sampleRenderTarget = null;
9697

9798
/**
9899
* The render target that represents the history of frame data.
99100
*
100101
* @private
101-
* @type {RenderTarget?}
102+
* @type {?RenderTarget}
103+
* @default null
102104
*/
103105
this._historyRenderTarget = null;
104106

0 commit comments

Comments
 (0)