Skip to content

Typecheck React DevTools extension main script#347

Closed
everettbu wants to merge 1 commit into
mainfrom
sebbie/01-15-typecheck_react_devtools_extension_main_script
Closed

Typecheck React DevTools extension main script#347
everettbu wants to merge 1 commit into
mainfrom
sebbie/01-15-typecheck_react_devtools_extension_main_script

Conversation

@everettbu

Copy link
Copy Markdown

Mirror of facebook/react#35519
Original author: eps1lon


Notably we ignore the passed theme in onThemeChanged and just do a plain re-render (introduced in react/react#33992).

Remove emission of unused extensionEditorPaneShown and extensionEditorPaneHidden events (added in react/react#33968).

@everettbu everettbu added CLA Signed React Core Team Opened by a member of the React Core Team labels Jan 15, 2026
@greptile-apps

greptile-apps Bot commented Jan 15, 2026

Copy link
Copy Markdown

Greptile Summary

This PR mirrors react/react#35519 and successfully adds Flow type annotations to the React DevTools extension main script while removing unused code patterns. The changes improve type safety and code maintainability without altering any functional behavior.

  • Added comprehensive Flow type annotations to packages/react-devtools-extensions/src/main/index.js, including type definitions for ExtensionEvent, ExtensionPort, and proper typing of module-level variables
  • Removed unused themeName parameter from the onThemeChanged() callback function, as the theme information is not used and the function only triggers a re-render
  • Removed unused event listener emissions for extensionEditorPaneShown and extensionEditorPaneHidden events that were not consumed anywhere in the codebase
  • Exported Message and FrontendEvents types from packages/react-devtools-shared/src/bridge.js to improve type accessibility
  • Extended LoggerEvent type in packages/react-devtools-shared/src/Logger.js with two new event types: selected-editor-pane and selected-inspected-element-pane

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk - it adds type annotations and removes unused code without altering any functional behavior.
  • Score of 5 reflects: (1) All changes are non-breaking and purely additive for type safety; (2) Removed code (unused parameter and event listeners) has been verified to have no usage in the codebase; (3) Type annotations are correct and consistent with existing patterns; (4) No functional logic is modified; (5) All type exports are properly accessible and used.
  • No files require special attention

Important Files Changed

Filename Overview
packages/react-devtools-extensions/src/main/index.js Comprehensive Flow type annotations added throughout the file for better type safety. Removed unused themeName parameter from onThemeChanged() callback. Removed unused event listeners for extensionEditorPaneShown and extensionEditorPaneHidden. Added type definitions for ExtensionEvent and ExtensionPort. All changes are correct and safe - no functional issues detected.
packages/react-devtools-shared/src/Logger.js Added two new event types to the LoggerEvent union: selected-editor-pane and selected-inspected-element-pane. These additions align with logging calls in the main extension script and properly extend the type definition.
packages/react-devtools-shared/src/bridge.js Exported Message and FrontendEvents types to make them available for importing in other modules. Both types are now properly marked as exportable, improving type accessibility across the codebase.

@everettbu

Copy link
Copy Markdown
Author

Upstream PR was closed or merged. Code is synced via branch mirror.

@everettbu everettbu closed this Jan 16, 2026
@everettbu
everettbu deleted the sebbie/01-15-typecheck_react_devtools_extension_main_script branch January 16, 2026 12:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed React Core Team Opened by a member of the React Core Team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants