docs: elevate the Entity class reference to peak quality#8814
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves the Entity API reference by replacing the terse class overview with a more complete conceptual introduction and examples, while also updating findComponent() documentation.
Changes:
- Expanded
Entityclass-level JSDoc with workflow guidance and cross-links. - Added two class-level examples for camera creation and hierarchy transforms.
- Updated
findComponent()return documentation.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
First page in a page-by-page effort to bring flagship API reference pages up to
the standard already set by the best pages (e.g. GSplatComponent, Vec3).
- Rewrites the Entity class overview into an authored introduction: the mental
model (a scene-graph node plus a set of components), the two facets it combines
(transform from GraphNode + components), and the typical workflow
(addComponent / accessor / removeComponent / enabled / destroy), with tight
cross-links to Component, GraphNode, AppBase#root and the common components.
- Adds two canonical, runnable class-level `@example`s (create a camera entity
and add it to the scene; parent/child transform inheritance).
- Fixes an accuracy bug: `findComponent()` was typed `{Component}` but actually
returns `null` when nothing is found (via `GraphNode#findOne`) - now
`{Component|null}`.
The 21 component accessors are intentionally left terse, and the other methods
were already at the bar.
Verified: lint clean, docs build with 0 errors and no new warnings, build:types
and test:types pass (`findComponent(type: string): Component | null`).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
c1f5189 to
63b8bc5
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
First page in a page-by-page effort to bring flagship API reference pages up to the standard already set by the best pages in the engine (e.g.
GSplatComponent,Vec3).Entityis the pilot that locks the bar for the rest.What changed
Entityclass overview into an authored introduction rather than a bare definition:addComponent→ access via the matching property →removeComponent, plus group enable/disable viaGraphNode#enabledand removal viadestroy;Component,GraphNode,AppBase#root, and the common components.@examples (create a camera entity and add it to the scene; parent/child transform inheritance).findComponent()was typed{Component}but documents and can returnundefined→ now{Component|undefined}.Deliberately unchanged: the 21 component accessors stay terse (they already link their component type), and the other methods (
addComponent,destroy,clone, …) were already at the bar.Verification
npm run lint✅npm run docs— 0 errors, no new warnings; all new{@link}s resolve; overview renders as a bulleted list with both examples ✅npm run build:types+npm run test:types✅Checklist
🤖 Generated with Claude Code