jooy2 / vitepress-sidebar

🔌 VitePress Sidebar is a plugin for VitePress that automatically configures and manages the sidebar of your page with simple settings.
https://vitepress-sidebar.cdget.com
MIT License
144 stars 7 forks source link

generateSidebar return type #119

Closed reisir closed 8 months ago

reisir commented 8 months ago

Describe the bug

Type 'Sidebar' is not assignable to type 'Sidebar | undefined'.
  Type 'SidebarMulti' is not assignable to type 'Sidebar | undefined'.
    Type 'SidebarMulti' is missing the following properties from type 'SidebarItem[]': length, pop, push, concat, and 28 more.ts(2322)

To Reproduce

    sidebar: generateSidebar({}),

Expected behavior

generateSidebar() should not be able to return undefined

Screenshots

image

Desktop (please complete the following information):

Additional context

Everything still works but TypeScript complains. It's annoying and makes the inexperienced user think they're doing something wrong.

Changing SidebarMultiItem.base to be required fixes it, idk TypeScript though so might be nonsense.

-base?: string;
+base: string;
jooy2 commented 8 months ago

Hello, thank you for using vitepress-sidebar. This issue has been fixed in 1.18.6. Can you try it after updating the plugin?

Regards,

reisir commented 8 months ago

Yeah after updating the plugin everything works. Thank you for the quick fix.