Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix doc and type #897

Merged
merged 4 commits into from
Sep 16, 2021
Merged

Conversation

mtgto
Copy link
Contributor

@mtgto mtgto commented Mar 13, 2021

  1. Fix old and broken urls of webdriver.io
  2. Fix sample code in README
  3. Fix type of SpectronWindow

2. helps some issues like #815, #831 .

3. fixes SpectronWindow type:

import { Application } from "spectron";
let app: Application;

// ... skip setup ...

app.client.getText('#error-alert'); // compile error
const windowCount: number = app.client.getWindowCount(); // compile error
const promisedWindowCount: Promise<number> = app.client.getWindowCount();

Comment on lines +121 to +127
export type SpectronWindow = {
[P in keyof Electron.BrowserWindow]: Electron.BrowserWindow[P] extends (
...args: infer A
) => infer R
? (...args: A) => Promise<R>
: undefined;
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I fixed this more completely in #999, using Promise<R extends PromiseLike<infer T> ? T : R> to avoid doubly-wrapped Promises, and wrapping every module in Electron, not just BrowserWindow.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@andersk Great works!

@VerteDinde VerteDinde merged commit 891321b into electron-userland:master Sep 16, 2021
@mtgto mtgto deleted the fix_doc_and_type branch October 3, 2021 05:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants