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

How to import "openAboutWindow" #86

Open
Andrew-web-coder opened this issue Jun 30, 2023 · 2 comments
Open

How to import "openAboutWindow" #86

Andrew-web-coder opened this issue Jun 30, 2023 · 2 comments

Comments

@Andrew-web-coder
Copy link

I try to import like this:

import openAboutWindow from 'about-window'

or

import { default as openAboutWindow } from 'about-window'

but all I get is "openAboutWindow" is not a function error message

@Andrew-web-coder
Copy link
Author

Andrew-web-coder commented Jun 30, 2023

I think the problem is that TS definitions are wrong, because source has exports.default = openAboutWindow; but definitions are without default - export default function openAboutWindow(info_or_img_path: AboutWindowInfo | string): Electron.BrowserWindow;.

And then this works -

openAboutWindow.default({
    icon_path: appIcon
})

but then the problem is with TS complaining about the types

@crystalfp
Copy link

Same, but a little more complex. I try to import in a ts file this way:
import * as openAboutWindow from "about-window"; and then openAboutWindow.default({...})
but it complains that
image
Same problem with import openAboutWindow from "about-window"; and then openAboutWindow({...}).
Could this be caused by the tsconfig.json that says:

  "compilerOptions": {
    "target": "ESNext",
    "module": "ESNext",

?
It it a so nice module, but seems I have to return to my old based on electron dialog.showMessageBoxSync

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

No branches or pull requests

2 participants