Skip to content

chore: Convert js files into typescript#115

Open
sabbir1991 wants to merge 1 commit into
mainfrom
chore/js-to-ts-migration-phase-2
Open

chore: Convert js files into typescript#115
sabbir1991 wants to merge 1 commit into
mainfrom
chore/js-to-ts-migration-phase-2

Conversation

@sabbir1991
Copy link
Copy Markdown
Member

@sabbir1991 sabbir1991 commented May 14, 2026

What

Migrate the remaining Phase 2 JS source files to TypeScript and finish the source-side JS to TS conversion for OneMedia.

Why

Phase 1 covered the higher-impact media sharing UI files. Phase 2 finishes the lower-risk support scripts that were still in JS, so the assets/src source tree is now fully migrated to TypeScript.

Related Issue(s):

  • Part of the JS to TS migration work

How

  • Migrated assets/src/js/media-frame.js to assets/src/js/media-frame.ts
  • Migrated assets/src/js/media-sync-filter.js to assets/src/js/media-sync-filter.ts
  • Updated webpack entries to point to the new .ts files
  • Kept file-local types local to the migrated files instead of creating unnecessary shared type modules
  • Reused existing shared WordPress/media typings where already applicable
  • Preserved kebab-case naming conventions across migrated source files
  • Confirmed there are no remaining .js or .jsx source files under assets/src

Testing Instructions

  1. Run npm run lint:js:types
  2. Run npm run lint:js -- assets/src/js/media-frame.ts assets/src/js/media-sync-filter.ts webpack.config.js
  3. Confirm webpack entries reference media-frame.ts and media-sync-filter.ts
  4. Confirm there are no remaining .js source files under assets/src

Screenshots

N/A

Additional Info

  • No source JS files remain in assets/src
  • Remaining .js files in the plugin are config files, generated build output, or vendor/test artifacts

Checklist

  • I have read the Contribution Guidelines.
  • I have read the Development Guidelines.
  • My code is tested to the best of my abilities.
  • My code passes all lints (ESLint etc.).
  • My code has detailed inline documentation.
  • I have updated the project documentation as needed.
  • I have added a changeset for this PR using npm run changeset.
Open WordPress Playground Preview

Copilot AI review requested due to automatic review settings May 14, 2026 14:26
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR completes the Phase 2 migration of remaining assets/src JavaScript media support scripts to TypeScript and updates webpack entry points accordingly.

Changes:

  • Replaced media-frame.js and media-sync-filter.js with TypeScript equivalents.
  • Added local TypeScript interfaces/types for WordPress media frame interactions.
  • Updated webpack entries to point to the new .ts sources.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
webpack.config.js Points media bundle entries to the new TypeScript files.
assets/src/js/media-sync-filter.ts TypeScript migration of the media sync filter script.
assets/src/js/media-sync-filter.js Removed after migration.
assets/src/js/media-frame.ts TypeScript migration of media frame customization and snackbar handling.
assets/src/js/media-frame.js Removed after migration.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +282 to +283
const detail = ( event as CustomEvent< SnackbarNoticeDetail > )
.detail?.detail;
@sabbir1991 sabbir1991 requested a review from justlevine May 14, 2026 15:23
@justlevine justlevine changed the title chore: Converted js files into typescripts chore: Convert js files into typescripts May 14, 2026
@justlevine
Copy link
Copy Markdown
Collaborator

(PS: we use conventiontional commits and WPCS. Part of that is using imperative tense. I.e. [it should] "Convert JS files to Typescript" . I updated here, and the last one before merge. Just letting you know why)

@justlevine justlevine changed the title chore: Convert js files into typescripts chore: Convert js files into typescript May 14, 2026
}
};

const isAttachmentModel = (
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Please restore/add docblocks and comments to all of these functions

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.

3 participants