webdriverio / query-selector-shadow-dom

querySelector that can pierce Shadow DOM roots without knowing the path through nested shadow roots. Useful for automated testing of Web Components. Production use is not advised, this is for test environments/tools such as Web Driver, Playwright, Puppeteer
MIT License
238 stars 25 forks source link

Argument of type 'CustomQueryHandler' is not assignable to parameter of type 'CustomQueryHandler' #77

Open christian-bromann opened 2 years ago

christian-bromann commented 2 years ago

With the latest release of puppeteer it seems that there are some type issues, e.g.

import puppeteer from 'puppeteer-core'
import { QueryHandler } from 'query-selector-shadow-dom/plugins/puppeteer/index.js'

puppeteer.registerCustomQueryHandler('shadow', QueryHandler)

This fails due to:

Argument of type 'CustomQueryHandler' is not assignable to parameter of type 'import("/workspace/webdriverio/packages/devtools/node_modules/puppeteer-core/lib/types").CustomQueryHandler'.
  Types of property 'queryAll' are incompatible.
    Type '((element: Element | Document, selector: string) => Element[] | NodeListOf<Element>) | undefined' is not assignable to type '((element: Node, selector: string) => Node[]) | undefined'.
      Type '(element: Element | Document, selector: string) => Element[] | NodeListOf<Element>' is not assignable to type '(element: Node, selector: string) => Node[]'.
        Type 'Element[] | NodeListOf<Element>' is not assignable to type 'Node[]'.
          Type 'NodeListOf<Element>' is missing the following properties from type 'Node[]': pop, push, concat, join, and 27 more.ts(2345)