rhysd / electron-about-window

'About This App' mini-window for Electron apps
https://www.npmjs.com/package/about-window
MIT License
409 stars 46 forks source link

How to import "openAboutWindow" #86

Open Andrew-web-coder opened 1 year ago

Andrew-web-coder commented 1 year ago

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 commented 1 year ago

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 commented 11 months ago

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