Skip to content

Build/Test Tools: Add accordion.js to TypeScript checking. - #14041

Closed
rahultank-spaceo wants to merge 1 commit into
WordPress:trunkfrom
rahultank-spaceo:65997-typecheck-accordion
Closed

rahultank-spaceo wants to merge 1 commit into
WordPress:trunkfrom
rahultank-spaceo:65997-typecheck-accordion

Conversation

@rahultank-spaceo

Copy link
Copy Markdown

Adds src/js/_enqueues/lib/accordion.js to the files checked by tsc (npm run typecheck:js).

With the file included, tsc reported 3 errors, all from one cause: the el parameter of accordionSwitch() was documented as {Object}, so el.closest() and el.attr() were reported as missing (TS2339). el is always a jQuery object (accordionSwitch( $( this ) )), so the JSDoc type is changed to {JQuery}. This matches the existing use of jQuery types in core JSDoc, such as {JQueryStatic} in color-picker.js and nav-menu.js.

Only a JSDoc comment changes in the script, so there is no runtime change.

Testing instructions

  1. Check out this branch and run npm run typecheck:js. It completes with no errors.
  2. Optional: revert only the JSDoc change in accordion.js and run it again. tsc reports the 3 TS2339 errors on lines 58 and 91.

Trac ticket: https://core.trac.wordpress.org/ticket/65997

Use of AI Tools

AI assistance: Yes
Used for: Initial draft of the change and this description; the change and the verification runs were reviewed and confirmed by me in a local environment.


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

Corrects the JSDoc type of the accordionSwitch() parameter from Object to JQuery, which resolves the type errors reported once the file is checked.

See #65997.
@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props rahultank.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown

Test using WordPress Playground

The changes in this pull request can previewed and tested using a WordPress Playground instance.

WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Some things to be aware of

  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

@lancewillett
lancewillett requested review from a team and a balanced review from Copilot October 11, 2026 07:01

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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@lancewillett

Copy link
Copy Markdown
Member

wporg-sync pushed a commit that referenced this pull request Oct 11, 2026
Include `accordion.js` in `tsconfig.json` and document the `accordionSwitch()` parameter as `JQuery` to match its callers and use of jQuery methods. This adds static checking without changing runtime behavior.

Developed in: #14041

Props rahultank.
See #65997.


git-svn-id: https://develop.svn.wordpress.org/trunk@64297 602fd350-edb4-49c9-b593-d223f7449a82
wporg-sync pushed a commit to WordPress/WordPress that referenced this pull request Oct 11, 2026
Include `accordion.js` in `tsconfig.json` and document the `accordionSwitch()` parameter as `JQuery` to match its callers and use of jQuery methods. This adds static checking without changing runtime behavior.

Developed in: WordPress/wordpress-develop#14041

Props rahultank.
See #65997.

Built from https://develop.svn.wordpress.org/trunk@64297


git-svn-id: http://core.svn.wordpress.org/trunk@63447 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

3 participants