Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Puppeteer template project TS build fails #1610

Closed
1 task
galaczi opened this issue Oct 18, 2022 · 1 comment · Fixed by #1637
Closed
1 task

Puppeteer template project TS build fails #1610

galaczi opened this issue Oct 18, 2022 · 1 comment · Fixed by #1637
Labels
bug Something isn't working.

Comments

@galaczi
Copy link

galaczi commented Oct 18, 2022

Which package is this bug report for? If unsure which one to select, leave blank

No response

Issue description

The default puppeteer build fails TS build.

npx crawlee create test-crawler
cd test-crawler
npm run build

Result:

> test-crawler@0.0.1 build
> tsc

node_modules/@crawlee/browser-pool/playwright/playwright-controller.d.ts:5:82 - error TS2344: Type 'unknown' does not satisfy the constraint 'Dictionary<any> | undefined'.

5 export declare class PlaywrightController extends BrowserController<BrowserType, Parameters<BrowserType['launch']>[0], Browser> {
                                                                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@crawlee/browser-pool/playwright/playwright-plugin.d.ts:7:74 - error TS2344: Type 'unknown' does not satisfy the constraint 'Dictionary<any> | undefined'.

7 export declare class PlaywrightPlugin extends BrowserPlugin<BrowserType, Parameters<BrowserType['launch']>[0], PlaywrightBrowser> {
                                                                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@crawlee/browser-pool/playwright/playwright-plugin.d.ts:11:67 - error TS2344: Type 'unknown' does not satisfy the constraint 'Dictionary<any> | undefined'.

11     protected _createController(): BrowserController<BrowserType, Parameters<BrowserType['launch']>[0], PlaywrightBrowser>;
                                                                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@crawlee/browser-pool/utils.d.ts:5:281 - error TS2344: Type '[...Result, PlaywrightPlugin]' does not satisfy the constraint 'BrowserPlugin<CommonLibrary, Dictionary<any> | undefined, CommonBrowser, unknown, CommonPage>[]'.
  Type 'PlaywrightPlugin | Result[number]' is not assignable to type 'BrowserPlugin<CommonLibrary, Dictionary<any> | undefined, CommonBrowser, unknown, CommonPage>'.
    Type 'PlaywrightPlugin' is not assignable to type 'BrowserPlugin<CommonLibrary, Dictionary<any> | undefined, CommonBrowser, unknown, CommonPage>'.
      Types of property 'launchOptions' are incompatible.
        Type 'unknown' is not assignable to type 'Dictionary<any> | undefined'.

5 export declare type InferBrowserPluginArray<Input extends readonly unknown[], Result extends BrowserPlugin[] = []> = Input extends readonly [infer FirstValue, ...infer Rest] | [infer FirstValue, ...infer Rest] ? FirstValue extends PlaywrightPlugin ? InferBrowserPluginArray<Rest, [...Result, PlaywrightPlugin]> : FirstValue extends PuppeteerPlugin ? InferBrowserPluginArray<Rest, [...Result, PuppeteerPlugin]> : never : Input extends [] ? Result : Input extends (infer U)[] ? [U] extends [PuppeteerPlugin | PlaywrightPlugin] ? U[] : never : Result;
                                                                                                                                                                                                                                                                                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@crawlee/playwright/internals/playwright-crawler.d.ts:14:73 - error TS2344: Type 'PlaywrightCrawlingContext<Dictionary<any>>' does not satisfy the constraint 'BrowserCrawlingContext<unknown, CommonPage, Dictionary<any>, BrowserController<CommonLibrary, Dictionary<any> | undefined, CommonBrowser, unknown, CommonPage>, Dictionary<...>>'.
  The types of 'browserController.browserPlugin' are incompatible between these types.
    Type 'BrowserPlugin<BrowserType, unknown, Browser, unknown, any>' is not assignable to type 'BrowserPlugin<CommonLibrary, Dictionary<any> | undefined, CommonBrowser, unknown, CommonPage>'.
      Type 'unknown' is not assignable to type 'Dictionary<any> | undefined'.

14 export interface PlaywrightRequestHandler extends BrowserRequestHandler<PlaywrightCrawlingContext> {
                                                                           ~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@crawlee/playwright/internals/playwright-crawler.d.ts:17:73 - error TS2344: Type 'PlaywrightCrawlingContext<Dictionary<any>>' does not satisfy the constraint 'BrowserCrawlingContext<unknown, CommonPage, Dictionary<any>, BrowserController<CommonLibrary, Dictionary<any> | undefined, CommonBrowser, unknown, CommonPage>, Dictionary<...>>'.

17 export interface PlaywrightCrawlerOptions extends BrowserCrawlerOptions<PlaywrightCrawlingContext, {
                                                                           ~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@crawlee/playwright/internals/playwright-crawler.d.ts:172:63 - error TS2344: Type '{ browserPlugins: [PlaywrightPlugin]; }' does not satisfy the constraint 'BrowserPoolOptions<BrowserPlugin<CommonLibrary, Dictionary<any> | undefined, CommonBrowser, unknown, CommonPage>>'.
  Types of property 'browserPlugins' are incompatible.
    Type '[PlaywrightPlugin]' is not assignable to type 'readonly BrowserPlugin<CommonLibrary, Dictionary<any> | undefined, CommonBrowser, unknown, CommonPage>[]'.
      Type 'PlaywrightPlugin' is not assignable to type 'BrowserPlugin<CommonLibrary, Dictionary<any> | undefined, CommonBrowser, unknown, CommonPage>'.

172 export declare class PlaywrightCrawler extends BrowserCrawler<{
                                                                  ~
173     browserPlugins: [PlaywrightPlugin];
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
174 }, LaunchOptions, PlaywrightCrawlingContext> {
    ~

node_modules/@crawlee/playwright/internals/playwright-launcher.d.ts:75:65 - error TS2344: Type 'PlaywrightPlugin' does not satisfy the constraint 'BrowserPlugin<CommonLibrary, Dictionary<any> | undefined, CommonBrowser, unknown, CommonPage>'.

75 export declare class PlaywrightLauncher extends BrowserLauncher<PlaywrightPlugin> {
                                                                   ~~~~~~~~~~~~~~~~


Found 8 errors in 5 files.

Errors  Files
     1  node_modules/@crawlee/browser-pool/playwright/playwright-controller.d.ts:5
     2  node_modules/@crawlee/browser-pool/playwright/playwright-plugin.d.ts:7
     1  node_modules/@crawlee/browser-pool/utils.d.ts:5
     3  node_modules/@crawlee/playwright/internals/playwright-crawler.d.ts:14
     1  node_modules/@crawlee/playwright/internals/playwright-launcher.d.ts:75

Code sample

No response

Package version

^3.0.0

Node.js version

v19.0.0

Operating system

Ubuntu

Apify platform

  • Tick me if you encountered this issue on the Apify platform

Priority this issue should have

Low (slightly annoying)

I have tested this on the next release

No response

Other context

No response

@galaczi galaczi added the bug Something isn't working. label Oct 18, 2022
@B4nan
Copy link
Member

B4nan commented Oct 18, 2022

We are aware of this and the fix is in progress. Possible workarounds:

  • add skipLibCheck: true to your tsconfig.json (into compilerOptions)
  • install playwright
  • use @crawlee/puppeteer instead of crawlee meta-package

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working.
Projects
None yet
2 participants