Skip to content

Commit

Permalink
Nodes: fix type errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Samuel Rigaud committed Dec 9, 2024
1 parent fa8e6a1 commit 2ef325b
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/nodes/core/NodeCache.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class NodeCache {
/**
* A weak map for managing node data.
*
* @type {WeakMap}
* @type {WeakMap<Node, Object>}
*/
this.nodesData = new WeakMap();

Expand Down
8 changes: 4 additions & 4 deletions src/nodes/core/NodeFrame.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,21 +48,21 @@ class NodeFrame {
/**
* Used to control the {@link Node#update} call.
*
* @type {WeakMap}
* @type {WeakMap<Node, Object>}
*/
this.updateMap = new WeakMap();

/**
* Used to control the {@link Node#updateBefore} call.
*
* @type {WeakMap}
* @type {WeakMap<Node, Object>}
*/
this.updateBeforeMap = new WeakMap();

/**
* Used to control the {@link Node#updateAfter} call.
*
* @type {WeakMap}
* @type {WeakMap<Node, Object>}
*/
this.updateAfterMap = new WeakMap();

Expand Down Expand Up @@ -113,7 +113,7 @@ class NodeFrame {
* is used to correctly call node update methods per frame or render.
*
* @private
* @param {WeakMap} referenceMap - The reference weak map.
* @param {WeakMap<Node, Object>} referenceMap - The reference weak map.
* @param {Node} nodeRef - The reference to the current node.
* @return {Object<String,WeakMap>} The dictionary.
*/
Expand Down
6 changes: 6 additions & 0 deletions src/nodes/core/ParameterNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,10 @@ class ParameterNode extends PropertyNode {

export default ParameterNode;

/**
*
* @param {string} type
* @param {string?} [name=null]
* @returns {ShaderNodeObject}
*/
export const parameter = ( type, name ) => nodeObject( new ParameterNode( type, name ) );
6 changes: 3 additions & 3 deletions src/nodes/core/TempNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ class TempNode extends Node {
/**
* Constructs a temp node.
*
* @param {String} type - The node type.
* @param {String?} nodeType - The node type.
*/
constructor( type ) {
constructor( nodeType = null ) {

super( type );
super( nodeType );

/**
* This flag can be used for type testing.
Expand Down
2 changes: 1 addition & 1 deletion src/nodes/display/ToonOutlinePassNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class ToonOutlinePassNode extends PassNode {
* An internal material cache.
*
* @private
* @type {WeakMap}
* @type {WeakMap<Material, NodeMaterial>}
*/
this._materialCache = new WeakMap();

Expand Down
2 changes: 1 addition & 1 deletion src/nodes/pmrem/PMREMNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ class PMREMNode extends TempNode {
* Reference to the generated PMREM.
*
* @private
* @type {Texture}
* @type {Texture | null}
* @default null
*/
this._pmrem = null;
Expand Down
2 changes: 1 addition & 1 deletion src/nodes/utils/LoopNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class LoopNode extends Node {
*/
getVarName( index ) {

return String.fromCharCode( 'i'.charCodeAt() + index );
return String.fromCharCode( 'i'.charCodeAt( 0 ) + index );

}

Expand Down
2 changes: 1 addition & 1 deletion src/nodes/utils/RTTNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const _size = /*@__PURE__*/ new Vector2();
* texture input for their effects. With the helper function `convertToTexture()` which is based
* on this module, the node system can automatically ensure texture input if required.
*
* @augments Node
* @augments TextureNode
*/
class RTTNode extends TextureNode {

Expand Down
4 changes: 2 additions & 2 deletions src/nodes/utils/ReflectorNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ class ReflectorBaseNode extends Node {
/**
* Weak map for managing render targets.
*
* @type {WeakMap}
* @type {WeakMap<Camera, RenderTarget>}
*/
this.renderTargets = new WeakMap();

Expand Down Expand Up @@ -299,7 +299,7 @@ class ReflectorBaseNode extends Node {
}

/**
* Returns a virtual camera for the given camera. The virutal camera is used to
* Returns a virtual camera for the given camera. The virtual camera is used to
* render the scene from the reflector's view so correct reflections can be produced.
*
* @param {Camera} camera - The scene's camera.
Expand Down

0 comments on commit 2ef325b

Please sign in to comment.