Skip to content

Fix chainable p5 instance methods returning void instead of p5#8426

Open
guan404ming wants to merge 1 commit intoprocessing:dev-2.0from
guan404ming:fix-chainable-return-types
Open

Fix chainable p5 instance methods returning void instead of p5#8426
guan404ming wants to merge 1 commit intoprocessing:dev-2.0from
guan404ming:fix-chainable-return-types

Conversation

@guan404ming
Copy link

Resolves #8415

Changes:

Previously, chainable methods on the main p5 class (like background(), stroke(), fill(), translate(), etc.) were typed to return void instead of p5 in the generated TypeScript definitions. This was due to an explicit exclusion condition options.currentClass !== 'p5' in the type generation logic.

  • Removes the exclusion so chainable methods on p5 return p5
  • Adds special handling for global mode to use P5 (the imported type) instead of p5 (which is a namespace in global.d.ts)

Screenshots of the change:

PR Checklist

@guan404ming guan404ming force-pushed the fix-chainable-return-types branch from 8781e22 to e0f5901 Compare January 30, 2026 19:09
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.

1 participant