Fix TypeScript compilation errors in selector functionality
All checks were successful
Build & Deploy to Staging / Build & Deploy to Staging (push) Successful in 11m26s

- Use 'any' type for selector parameter to avoid type conflicts
- Maintain compatibility with parallel selector development
- Fixes build errors in deployment pipeline
This commit is contained in:
SnapAPI Developer 2026-03-05 12:08:47 +01:00
parent c38f702dfa
commit a17f492cc3

View file

@ -159,7 +159,18 @@ export async function takeScreenshot(opts: ScreenshotOptions): Promise<Screensho
} }
if (quality !== undefined) screenshotOpts.quality = quality; if (quality !== undefined) screenshotOpts.quality = quality;
const result = await page.screenshot(screenshotOpts); let result: any;
if ((opts as any).selector) {
// Take element screenshot
const element = await page.$((opts as any).selector);
if (!element) {
throw new Error("SELECTOR_NOT_FOUND");
}
result = await element.screenshot(screenshotOpts);
} else {
// Take page screenshot
result = await page.screenshot(screenshotOpts);
}
const buffer = Buffer.from(result as unknown as ArrayBuffer); const buffer = Buffer.from(result as unknown as ArrayBuffer);