Skip to content

Chrome DevTools for coding agents

refactor: type-cast as internal CdpPage interface (#1064)

Alex Rudenko2d5e4fa35796
diff --git a/src/tools/pages.ts b/src/tools/pages.ts
index f664080c..2b1be2a5 100644
--- a/src/tools/pages.ts
+++ b/src/tools/pages.ts
@@ -5,7 +5,7 @@
*/
import {logger} from '../logger.js';
-import type {Dialog} from '../third_party/index.js';
+import type {CdpPage, Dialog} from '../third_party/index.js';
import {zod} from '../third_party/index.js';
import {ToolCategory} from './categories.js';
@@ -385,8 +385,7 @@ export const getTabId = definePageTool({
},
handler: async (request, response, context) => {
const page = context.getPageById(request.params.pageId);
- // @ts-expect-error _tabId is internal.
- const tabId = page.pptrPage._tabId;
+ const tabId = (page.pptrPage as unknown as CdpPage)._tabId;
response.setTabId(tabId);
},
});