query-selector-shadow-dom icon indicating copy to clipboard operation
query-selector-shadow-dom copied to clipboard

Could not find a declaration file for module 'query-selector-shadow-dom/plugins/puppeteer'

Open Tigrao75 opened this issue 4 years ago • 2 comments

Hi @Georgegriff , Sorry to bother you, but I'm facing some problems using your plugin. I tried to figure out the problem myself, but I couldn't. So, I thought to ask for your help: I used your example for PUPPETEER for shadow-dom and I getting error in the "require": const { QueryHandler } = require("query-selector-shadow-dom/plugins/puppeteer");

I got this error when I hover the mouse in this line: "module "C:/Puppeteer/node_modules/query-selector-shadow-dom/plugins/puppeteer/index" Could not find a declaration file for module 'query-selector-shadow-dom/plugins/puppeteer'. 'C:/Puppeteer/node_modules/query-selector-shadow-dom/plugins/puppeteer/index.js' implicitly has an 'any' type. Try npm i --save-dev @types/query-selector-shadow-dom if it exists or add a new declaration (.d.ts) file containing declare module 'query-selector-shadow-dom/plugins/puppeteer';ts(7016)"

I'm using visual Code. I'm able to see the plugin instaled but even so, I get this annoying error and my query is not woking and I think this error is the problem.

Thank you in advance. Luciano.

Tigrao75 avatar Apr 22 '21 11:04 Tigrao75

This looks like a typescript issue, I don't believe there are types declares for this plugin, feel free to contribute some if you want, other than that you should be able to ignore the typescript error somehow

As an aside puppeteer has a built in selector named pierce, they don't document it which is a bit annoying, but https://github.com/puppeteer/puppeteer/pull/6509

Georgegriff avatar Apr 22 '21 11:04 Georgegriff

You could also document the types yourself in your project, someone in webdriverio recently did they for the web driver plugin https://github.com/webdriverio/webdriverio/blob/0535493274b6f3b7ff5d7c5a44731e3d6d8ea461/%40types/query-selector-shadow-dom.d.ts

Georgegriff avatar Apr 22 '21 11:04 Georgegriff