[Bug] Implementing cypress-shadow-dom as typescript
arielazzi opened this issue ยท 7 comments
Description
we're implementing cypress-shadow-dom
in our project, but we also use Cypress with Typescript. We tried to add the package with the following statement, but it didn't work:
/// <reference path="../node_modules/cypress-shadow-dom/index.d.ts" />
Could you please advise us on how to implement it?
Hi @arielazzi
Thanks for submitting the issue.
Seems it should work if you use it like you've described:
https://github.com/cypress-io/cypress-xpath/pull/16/files
Have you tried setting the path to /// <reference path="cypress-shadow-dom" />
?
Hi @abramenal
Thank you so much for your fast response!
we tried to implement your suggestion, but it didn't work. Could you please clarify your answer?
Thanks
Hi @allout58
You was doing this MR: abramenal/cypress-file-upload#5
I am curious if you know anything that could help @arielazzi about how exactly you incorporate custom command typings into your project.
Much appreciated!! ๐
@abramenal I can add some typings when I get a chance, might be a few days though.
@arielazzi If you look at the PR in the comment above, you can get an idea of how to add in the typings yourself if you need it sooner
Whoops, I didn't see you already had typings. I can take a look, but I'm not sure if I can be all that helpful ๐ฆ
I was able to get it to work as is, but I added cypress-shadow-dom
to the types
array in tsconfig.json
instead of your reference version.
@arielazzi What version of TS are you using?
Ahha! According to the TypeScript documentation you have to change it to /// <reference *types*="cypress-shadow-dom">
. It also says to not use the reference method unless you are writing a .d.ts
by hand, but to use the method I mentioned above instead