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

Missing Promise for {electron, browserWindow, webContents} types #998

Open
andersk opened this issue Jul 8, 2021 · 0 comments · May be fixed by #999
Open

Missing Promise for {electron, browserWindow, webContents} types #998

andersk opened this issue Jul 8, 2021 · 0 comments · May be fixed by #999

Comments

@andersk
Copy link
Contributor

andersk commented Jul 8, 2021

The spectron TypeScript declarations copy the RemoteMainInterface, BrowserWindow, WebContents types from electron, but this leads to incorrect type errors because spectron changes all the methods on these interfaces return Promises.

For example, given

import electronPath from "electron";
import { Application } from "spectron";

const app = new Application({
  path: electronPath as unknown as string,
  args: ["./app"],
});

app.start().then(() =>
  app.browserWindow.isVisible().then((visible: boolean) => {
    console.log(visible);
    app.stop();
  })
);

TypeScript complains:

test.ts:10:33 - error TS2339: Property 'then' does not exist on type 'boolean'.

10   app.browserWindow.isVisible().then((visible: boolean) => {
                                   ~~~~


Found 1 error.
andersk added a commit to andersk/spectron that referenced this issue Jul 8, 2021
andersk added a commit to andersk/spectron that referenced this issue Jul 8, 2021
andersk added a commit to andersk/spectron that referenced this issue Jul 8, 2021
andersk added a commit to andersk/spectron that referenced this issue Sep 16, 2021
andersk added a commit to andersk/spectron that referenced this issue Jan 11, 2022
andersk added a commit to andersk/spectron that referenced this issue Feb 2, 2022
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 a pull request may close this issue.

1 participant