Skip to content

docs: fix incorrect JSDoc in public APIs#8612

Merged
willeastcott merged 2 commits into
mainfrom
docs/jsdoc-public-api-fixes
Apr 19, 2026
Merged

docs: fix incorrect JSDoc in public APIs#8612
willeastcott merged 2 commits into
mainfrom
docs/jsdoc-public-api-fixes

Conversation

@willeastcott

Copy link
Copy Markdown
Contributor

Summary

Docs-only PR fixing a small set of objectively-wrong JSDoc issues in public-facing APIs. No runtime behaviour changes.

Type corrections

  • CalculateSortDistanceCallback in src/scene/mesh-instance.js: was documented as @returns {void}, but Layer#_calculateSortDistances uses the result as a numeric sort distance. Corrected to @returns {number}.
  • Compute#getParameter in src/platform/graphics/compute.js: return union was missing TextureView, which is an allowed value per setParameter. Added to the union.

Typos / grammar in public JSDoc prose

  • src/scene/graph-node.js:
    • findByName param described "the name of the graph" -> "the name of the node".
    • find / findOne said "the valued passed" -> "the value passed".
    • findOne @returns "A graph node that match" -> "that matches".
    • findByTag description "each tag of array" -> "each tag of the array"; examples "nodes that tagged by" -> "nodes tagged with" (and fixed "assets" -> "graph nodes" for accuracy).
  • src/framework/script/script-type.js: class summary rewritten from "You should not use this inherit from this class directly." to "Do not inherit from this class directly.", and fixed missing article.
  • Removed duplicated "when when" in event descriptions in src/extras/gizmo/transform-gizmo.js (2 sites), src/extras/gizmo/gizmo.js, and src/framework/i18n/i18n.js.

Broken @example

  • TransformGizmo.EVENT_TRANSFORMMOVE example used ${...} inside single quotes, so it logged literal ${pointDelta}. Converted to a backtick template literal.

Public API changes

Only JSDoc types change; no runtime signatures change. Two documented types are widened:

Before:

/**
 * @callback CalculateSortDistanceCallback
 * @returns {void}
 */

After:

/**
 * @callback CalculateSortDistanceCallback
 * @returns {number}
 */

Before:

/**
 * @returns {number|number[]|Float32Array|Texture|StorageBuffer|VertexBuffer|IndexBuffer|undefined}
 */
getParameter(name) { ... }

After:

/**
 * @returns {number|number[]|Float32Array|Texture|StorageBuffer|VertexBuffer|IndexBuffer|TextureView|undefined}
 */
getParameter(name) { ... }

Test plan

  • npx eslint on all touched files passes.
  • No behavioural code changes; nothing else to test.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Docs-only PR correcting a handful of objectively incorrect / misleading JSDoc annotations and examples in public-facing APIs (no runtime behavior changes).

Changes:

  • Corrected CalculateSortDistanceCallback to document a numeric return value used for sorting.
  • Widened Compute#getParameter documented return union to include TextureView (matching setParameter).
  • Fixed typos/grammar in several public JSDoc blocks and repaired a broken @example template-literal log.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/scene/mesh-instance.js Fixes callback return type docs for sort-distance calculation.
src/scene/graph-node.js Fixes multiple typos/grammar in find* / tag-query JSDoc and examples.
src/platform/graphics/compute.js Updates getParameter JSDoc return union to include TextureView.
src/framework/script/script-type.js Clarifies legacy ScriptType class summary wording in JSDoc.
src/framework/i18n/i18n.js Removes duplicated “when when” in locale-change event JSDoc.
src/extras/gizmo/transform-gizmo.js Fixes duplicated “when when” and corrects @example to use a template literal.
src/extras/gizmo/gizmo.js Removes duplicated “when when” in render-update event JSDoc.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/scene/graph-node.js Outdated
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@willeastcott willeastcott merged commit eeae780 into main Apr 19, 2026
12 checks passed
@willeastcott willeastcott deleted the docs/jsdoc-public-api-fixes branch April 19, 2026 18:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants