From af271a580c8f48a1ecf761e4e7e574198432a74e Mon Sep 17 00:00:00 2001 From: olivierwilkinson Date: Sun, 20 Jun 2021 11:57:42 +0100 Subject: [PATCH] docs: add note about including dom types in WTL WebdriverIO Testing Library assumes that users include the DOM types in their typescript default types. Add a note to the Typescript section of the WTL docs to help users who are finding type errors when they haven't. Related issue: https://github.com/testing-library/webdriverio-testing-library/issues/22 --- docs/webdriverio-testing-library/intro.mdx | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/docs/webdriverio-testing-library/intro.mdx b/docs/webdriverio-testing-library/intro.mdx index f28bfacea..208085f12 100644 --- a/docs/webdriverio-testing-library/intro.mdx +++ b/docs/webdriverio-testing-library/intro.mdx @@ -156,6 +156,18 @@ declare global { } ``` +If you are finding an error similar to this: + +```typescript +browser.getByRole('navigation') +// "Argument of type '"navigation"' is not assignable to parameter of type 'ByRoleOptions | undefined'." +``` + +you need to include "DOM" in the +[lib](https://www.typescriptlang.org/tsconfig#lib) option of your tsconfig. See +[here](https://github.com/testing-library/webdriverio-testing-library/issues/22) +for more information. + Additional information about using typescript with WebdriverIO can be found [here](https://webdriver.io/docs/typescript/)