diff --git a/packages/docusaurus-plugin-openapi-docs/src/plugin-content-docs-types.d.ts b/packages/docusaurus-plugin-openapi-docs/src/plugin-content-docs-types.d.ts index e014cf287..de33fe974 100644 --- a/packages/docusaurus-plugin-openapi-docs/src/plugin-content-docs-types.d.ts +++ b/packages/docusaurus-plugin-openapi-docs/src/plugin-content-docs-types.d.ts @@ -5,10 +5,42 @@ * LICENSE file in the root directory of this source tree. * ========================================================================== */ -declare module "@docusaurus/plugin-content-docs-types" { - // Makes all properties visible when hovering over the type - type Expand> = { [P in keyof T]: T[P] }; +// Makes all properties visible when hovering over the type +type Expand> = { [P in keyof T]: T[P] }; + +export type SidebarItemBase = { + className?: string; + customProps?: Record; +}; + +export type SidebarItemLink = SidebarItemBase & { + type: "link"; + href: string; + label: string; + docId: string; +}; + +type SidebarItemCategoryBase = SidebarItemBase & { + type: "category"; + label: string; + collapsed: boolean; + collapsible: boolean; +}; +export type PropSidebarItemCategory = Expand< + SidebarItemCategoryBase & { + items: PropSidebarItem[]; + } +>; + +export type PropSidebarItem = SidebarItemLink | PropSidebarItemCategory; +export type PropSidebar = PropSidebarItem[]; +export type PropSidebars = { + [sidebarId: string]: PropSidebar; +}; + +// Also declare the module for backwards compatibility +declare module "@docusaurus/plugin-content-docs-types" { export type SidebarItemBase = { className?: string; customProps?: Record; diff --git a/packages/docusaurus-plugin-openapi-docs/src/types.ts b/packages/docusaurus-plugin-openapi-docs/src/types.ts index 4f7310f6d..e52814582 100644 --- a/packages/docusaurus-plugin-openapi-docs/src/types.ts +++ b/packages/docusaurus-plugin-openapi-docs/src/types.ts @@ -21,7 +21,8 @@ export type { SidebarItemLink, PropSidebar, PropSidebarItem, -} from "@docusaurus/plugin-content-docs-types"; +} from "./plugin-content-docs-types"; + export interface PluginOptions { id?: string; docsPlugin?: string;