neutralinojs / neutralino.js

JavaScript API for Neutralinojs
https://neutralino.js.org/docs/api/overview
MIT License
237 stars 47 forks source link

Incompatible type exported for os.TrayOptions #78

Closed jouni-kantola closed 1 year ago

jouni-kantola commented 1 year ago

The TypeScript API for os.setTray expects param options as TrayOptions with property menu instead of menuItems:

interface TrayOptions {
  icon?: string;
  menu?: TrayMenuItem[];
}

In runtime, the application crashes if menu is used. If on the other hand passed as menuItems (as per described in the docs) everything works as expected, e.g.:

await os.setTray({
    icon: "/resources/icons/my-app-icon.png",
    // mismatching type defined with menu?: TrayMenuItem[];
    menuItems: [
        {
            id: "OPEN",
            text: "Open",
        }
    ]
});