Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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<T extends Record<string, unknown>> = { [P in keyof T]: T[P] };
// Makes all properties visible when hovering over the type
type Expand<T extends Record<string, unknown>> = { [P in keyof T]: T[P] };

export type SidebarItemBase = {
className?: string;
customProps?: Record<string, unknown>;
};

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<string, unknown>;
Expand Down
3 changes: 2 additions & 1 deletion packages/docusaurus-plugin-openapi-docs/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down