最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

reactjs - Custom-Electron-Titlebar removeMenuBar typescript issue - Stack Overflow

programmeradmin4浏览0评论

I'm having an issue with with react and typescript while building an electron app. I'm trying to set up custom-electron-titlebar with my app. For the most part its working fine. However, i have run into webstorm telling me...

TS2353: Object literal may only specify known properties, and removeMenuBar does not exist in type TitleBarOption

When i look at the code sure enough there is no "removeMenuBar" on the interface. I assume this was removed for some reason or another but the docs was never updated. Can someone help explain to me how i can remove the menu bar from the titlebar? I have searched and searched and come up empty handed.

import { Titlebar, TitlebarColor } from "custom-electron-titlebar";

window.addEventListener("DOMContentLoaded", () => {
    new Titlebar({
        backgroundColor: TitlebarColor.fromHex("#000000"),
        titleHorizontalAlignment: "center",
        menuTransparency: 100,
        removeMenuBar: true,
    });
});

I'm having an issue with with react and typescript while building an electron app. I'm trying to set up custom-electron-titlebar with my app. For the most part its working fine. However, i have run into webstorm telling me...

TS2353: Object literal may only specify known properties, and removeMenuBar does not exist in type TitleBarOption

When i look at the code sure enough there is no "removeMenuBar" on the interface. I assume this was removed for some reason or another but the docs was never updated. Can someone help explain to me how i can remove the menu bar from the titlebar? I have searched and searched and come up empty handed.

import { Titlebar, TitlebarColor } from "custom-electron-titlebar";

window.addEventListener("DOMContentLoaded", () => {
    new Titlebar({
        backgroundColor: TitlebarColor.fromHex("#000000"),
        titleHorizontalAlignment: "center",
        menuTransparency: 100,
        removeMenuBar: true,
    });
});
Share Improve this question edited Mar 28 at 13:04 jam j 6241 gold badge2 silver badges19 bronze badges asked Mar 23 at 4:58 Chris WilliamsonChris Williamson 812 silver badges9 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

The library custom-electron-titlebar is archived, meaning it's not longer maintained. The README is up to date, but not the latest version of the library published on npm. The latter was published on Jan 15 2024, while the functionality you want (added via this PR) has been merged on May 11 2024.

If you still want to use this library anyway, you need to install it from github directly:

npm install "https://github/AlexTorresDev/custom-electron-titlebar.git#main" --save

More details on this question.

Note that because the library uses pnpm, if you use Yarn Berry, then you won't be able to do that because of this issue (or this one).

发布评论

评论列表(0)

  1. 暂无评论