Skip to content

Fix BaseTween callback types - #7376

Open
bagel786 wants to merge 1 commit into
phaserjs:masterfrom
bagel786:fix/base-tween-callback-types
Open

Fix BaseTween callback types#7376
bagel786 wants to merge 1 commit into
phaserjs:masterfrom
bagel786:fix/base-tween-callback-types

Conversation

@bagel786

Copy link
Copy Markdown

This PR

  • Fixes a bug

Model BaseTween callback slots as the required nullable handler objects used at runtime, including their callback parameters. Add a TypeScript generation regression for every callback key.

Tests:

  • npm run ts
  • ESLint 8 on the changed JSDoc sources

Fixes #7353


Continues #7358 — the fork repo backing that PR was accidentally deleted from this account, and GitHub blocks reopening a PR whose submitting repository was deleted (a restore request is being filed with GitHub Support). This PR resumes the identical work from the same commit (ce4ef80d995133a6bcdf44534bb0339c9ba79b4c); review discussion continues on the original PR.

Copilot AI lite review requested due to automatic review settings September 11, 2026 20:29

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 Needs a closer look

The shipped types/phaser.d.ts artifact still contains the incorrect callback declarations.

Pull request overview

Fixes BaseTween callback typings to match runtime handler objects and adds TypeScript regression coverage.

Changes:

  • Adds nullable callback handler and parameter typings.
  • Clarifies callback documentation.
  • Adds generated TypeScript usage coverage.
File summaries
File Summary
src/tweens/typedefs/TweenCallbacks.js Defines corrected callback handler types.
src/tweens/tween/BaseTween.js Updates callback documentation.
scripts/tsgen/test/src/game.ts Verifies generated callback typings.
Review details

Suppressed comments (1)

src/tweens/typedefs/TweenCallbacks.js:6

  • The package exports types/phaser.d.ts (package.json:12,17), but that generated file still declares TweenCallbacks as optional callback functions (types/phaser.d.ts:105134-105175). Running npm run ts may update it locally, but the declaration artifact is not included in this change, so package consumers will continue to see the incorrect API; regenerate and commit the published declaration (or otherwise update the shipped type artifact).
 * @typedef {object} Phaser.Types.Tweens.TweenCallbackData
 * @since 4.3.0
 *
 * @property {function} func - The callback function.
 * @property {array} params - Additional parameters to pass to the callback.
  • Files reviewed: 3/3 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BaseTween#callbacks type is inconsistent with runtime behaviour

2 participants