Skip to content

Commit

Permalink
Merge pull request #30 from testing-library/fix-types-for-wdio-v7.9
Browse files Browse the repository at this point in the history
fix: types when using wdio v7.9
  • Loading branch information
olivierwilkinson authored Aug 30, 2021
2 parents 887f5c1 + 00f7d22 commit e907070
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@
"@types/simmerjs": "^0.5.1",
"@typescript-eslint/eslint-plugin": "^4.14.0",
"@typescript-eslint/parser": "^4.14.0",
"@wdio/cli": "^7.3.1",
"@wdio/local-runner": "^7.3.1",
"@wdio/mocha-framework": "^7.3.1",
"@wdio/selenium-standalone-service": "^7.7.3",
"@wdio/spec-reporter": "^7.3.1",
"@wdio/sync": "^7.3.1",
"@wdio/cli": "^7.9.0",
"@wdio/local-runner": "^7.9.0",
"@wdio/mocha-framework": "^7.9.0",
"@wdio/selenium-standalone-service": "^7.9.0",
"@wdio/spec-reporter": "^7.9.0",
"@wdio/sync": "^7.9.0",
"eslint": "^7.6.0",
"kcd-scripts": "^11.1.0",
"npm-run-all": "^4.1.5",
Expand Down
17 changes: 11 additions & 6 deletions src/wdio-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,17 @@ declare global {
}
}

export type $ = (
selector: any,
) =>
| ChainablePromiseElementBase<Promise<WebdriverIO.Element>>
| Promise<WebdriverIO.Element>
| WebdriverIO.Element

export type ChainablePromiseElementBase<T> = Promise<T> & {$: $}

export type ElementBase = {
$(
selector: object | string,
): Promise<WebdriverIO.Element> | WebdriverIO.Element
$: $

execute<T>(
script: string | ((...args: any[]) => T),
Expand All @@ -31,9 +38,7 @@ export type ElementBase = {
}

export type BrowserBase = {
$(
selector: object | string,
): Promise<WebdriverIO.Element> | WebdriverIO.Element
$: $

addCommand<T extends boolean>(
queryName: string,
Expand Down

0 comments on commit e907070

Please sign in to comment.