rebrowser / rebrowser-patches

Collection of patches for puppeteer and playwright to avoid automation detection and leaks. Helps to avoid Cloudflare and DataDome CAPTCHA pages. Easy to patch/unpatch, can be enabled/disabled on demand.
https://rebrowser.net
285 stars 25 forks source link

Typescript shows missing modules/classes/interfaces incorrectly #34

Open DjSt3rios opened 1 week ago

DjSt3rios commented 1 week ago

Hello, I am using rebrowser-playwright package version 1.47.100, and I decided to convert my project to TypeScript. While the code executes just fine, some classes are marked red and shows errors if I hover over them, and are a bit distracting. An example code:

import playwright, {Browser} from "rebrowser-playwright";

async function run() {
    const browser: Browser = await playwright.chromium.launch({
        headless: false,
        channel: "chrome"
    });
    const page = await browser.newPage();
    await page.setViewportSize({ height: 1060, width: 1920});

    await page.goto('https://bot-detector.rebrowser.net', { waitUntil: 'domcontentloaded' });
    await new Promise((resolve) => setTimeout(resolve, 10000));
    await browser.close();
}

await run();

the "Browser" interface import is marked as an error by jetbrains IDE: TS2305: Module "rebrowser-playwright" has no exported member Browser

at playwright.chromium.launch, the chromium keyword is also marked red, and shows this error when hovered: TS2339: Property chromium does not exist on type "typeof import("C:/Users/user/IdeaProjects/playwright-real-browser/node_modules/rebrowser-playwright/index")"

It's not very important since the code runs, but it would be nice if it could be fixed