Skip to content

Commit

Permalink
fix(dev-middleware): allow passing ?Page | ?PageWithMiddleware to `…
Browse files Browse the repository at this point in the history
…Device` functions and properties
  • Loading branch information
byCedric committed Mar 4, 2024
1 parent 9c5ee49 commit 91e8328
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions packages/dev-middleware/src/inspector-proxy/Device.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export default class Device {
// Last known Page ID of the React Native page.
// This is used by debugger connections that don't have PageID specified
// (and will interact with the latest React Native page).
#lastConnectedLegacyReactNativePage: ?Page = null;
#lastConnectedLegacyReactNativePage: ?Page | ?PageWithMiddleware = null;

// Whether we are in the middle of a reload in the REACT_NATIVE_RELOADABLE_PAGE.
#isLegacyPageReloading: boolean = false;
Expand Down Expand Up @@ -333,7 +333,10 @@ export default class Device {
/**
* Returns `true` if a page supports the given target capability flag.
*/
#pageHasCapability(page: Page, flag: $Keys<TargetCapabilityFlags>): boolean {
#pageHasCapability(
page: Page | PageWithMiddleware,
flag: $Keys<TargetCapabilityFlags>,
): boolean {
return page.capabilities[flag] === true;
}

Expand Down Expand Up @@ -495,7 +498,7 @@ export default class Device {
}

// We received new React Native Page ID.
#newLegacyReactNativePage(page: Page) {
#newLegacyReactNativePage(page: Page | PageWithMiddleware) {
debug(`React Native page updated to ${page.id}`);
if (
this.#debuggerConnection == null ||
Expand Down

0 comments on commit 91e8328

Please sign in to comment.