docs: replace opaque any/* types with real types in API reference#8811
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves the generated public API reference by replacing two opaque JSDoc types (* / any) with concrete, recoverable types so TypeDoc and the generated .d.ts don’t expose meaningless any in these APIs.
Changes:
- Updated
RenderTarget.getColorBuffer(index)JSDoc to typeindexas{number}instead of{*}. - Updated
InputConsumer.update()JSDoc return type from{any}to{Pose|undefined}to match the controller pose returned byInputController.update()while allowing the base implementation to discard frames.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/platform/graphics/render-target.js | Refines getColorBuffer parameter type for clearer public API docs / typings. |
| src/extras/input/input.js | Refines InputConsumer.update return type to avoid any in public docs / typings. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
c3fc3ec to
d0d25bb
Compare
Two public, reference-visible members documented their JSDoc types as the opaque `*`/`any`, which renders as a meaningless `any` in the generated TypeDoc API reference:
- `RenderTarget.getColorBuffer(index)` - `index` is an array index, typed `{*}` -> `{number}`.
- `InputConsumer.update()` - the base method discards the frame and returns nothing, so the bogus `@returns {any}` is dropped (per the engine convention of omitting `@returns` when nothing is returned); the `InputController` subclass override already documents its `{Pose}` return.
Both compile cleanly (build:types/test:types); the generated declarations now read `getColorBuffer(index: number): Texture` and `InputConsumer.update(...): void` / `InputController.update(...): Pose`.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
d0d25bb to
dfcbc5b
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
Two public, reference-visible members documented their JSDoc types as the opaque
*/any, which renders as a meaninglessanyin the generated TypeDoc API reference. This replaces them with accurate types:RenderTarget.getColorBuffer(index)—indexis an array index, typed{*}→{number}.InputConsumer.update()— the base method discards the frame and returns nothing, so the bogus@returns {any}is dropped (per the engine convention of omitting@returnswhen nothing is returned). TheInputControllersubclass override already documents its{Pose}return.After the change the generated declarations read
getColorBuffer(index: number): Texture,InputConsumer.update(...): void, andInputController.update(...): Pose; the renderedRenderTargetpage drops from 2 → 0anytokens.Scope note for reviewers
This is a deliberately small, surgical change. A wider audit of
@param {*}/{any}usage (~100 hits across 37 files) found that the large majority sit on@private/@ignoremembers that are excluded from the reference (excludePrivatedefaults totrue), or are legitimately dynamic public APIs (EventHandlerevent args,Httpresponse payloads,Asset.resource, uniform values) whereanyis the correct type. These were the only public, reference-visible members whose type was genuinely recoverable.Verification
npm run lint✅npm run build:types✅npm run test:types✅npm run docs— 0 errors ✅Checklist
🤖 Generated with Claude Code