Skip to content

Commit fbca820

Browse files
committed
refactor: use docusaurus sidebar types
1 parent afa156a commit fbca820

File tree

4 files changed

+11
-81
lines changed

4 files changed

+11
-81
lines changed

packages/docusaurus-plugin-openapi-docs/src/plugin-content-docs-types.d.ts

Lines changed: 0 additions & 42 deletions
This file was deleted.

packages/docusaurus-plugin-openapi-docs/src/plugin-openapi.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import type { FrontMatter as DocsFrontMatter } from "@docusaurus/types";
1111
import type { Props as DocsProps } from "@docusaurus/types";
1212

1313
declare module "docusaurus-plugin-openapi-docs" {
14-
import type { PropSidebars } from "@docusaurus/plugin-content-docs-types";
14+
import type { PropSidebars } from "@docusaurus/plugin-content-docs/lib/sidebars/types";
1515

1616
export type Options = Partial<import("./types").APIOptions>;
1717

packages/docusaurus-plugin-openapi-docs/src/types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* LICENSE file in the root directory of this source tree.
66
* ========================================================================== */
77

8-
import { SidebarItemDoc } from "@docusaurus/plugin-content-docs/src/sidebars/types";
8+
import type { SidebarItemDoc } from "@docusaurus/plugin-content-docs/lib/sidebars/types";
99
import Request from "postman-collection";
1010

1111
import {
@@ -21,7 +21,7 @@ export type {
2121
SidebarItemLink,
2222
PropSidebar,
2323
PropSidebarItem,
24-
} from "@docusaurus/plugin-content-docs-types";
24+
} from "@docusaurus/plugin-content-docs/lib/sidebars/types";
2525
export interface PluginOptions {
2626
id?: string;
2727
docsPlugin?: string;

packages/docusaurus-theme-openapi-docs/src/theme-openapi.d.ts

Lines changed: 8 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -7,43 +7,15 @@
77

88
/// <reference types="docusaurus-plugin-openapi-docs" />
99

10-
/* eslint-disable @typescript-eslint/no-use-before-define */
10+
export type {
11+
PropSidebarItemCategory,
12+
SidebarItemLink,
13+
PropSidebar,
14+
PropSidebarItem,
15+
PropSidebars,
16+
} from "@docusaurus/plugin-content-docs/lib/sidebars/types";
1117

12-
declare module "@docusaurus/plugin-content-docs-types" {
13-
// Makes all properties visible when hovering over the type
14-
type Expand<T extends Record<string, unknown>> = { [P in keyof T]: T[P] };
15-
16-
export type SidebarItemBase = {
17-
className?: string;
18-
customProps?: Record<string, unknown>;
19-
};
20-
21-
export type SidebarItemLink = SidebarItemBase & {
22-
type: "link";
23-
href: string;
24-
label: string;
25-
docId: string;
26-
};
27-
28-
type SidebarItemCategoryBase = SidebarItemBase & {
29-
type: "category";
30-
label: string;
31-
collapsed: boolean;
32-
collapsible: boolean;
33-
};
34-
35-
export type PropSidebarItemCategory = Expand<
36-
SidebarItemCategoryBase & {
37-
items: PropSidebarItem[];
38-
}
39-
>;
40-
41-
export type PropSidebarItem = SidebarItemLink | PropSidebarItemCategory;
42-
export type PropSidebar = PropSidebarItem[];
43-
export type PropSidebars = {
44-
[sidebarId: string]: PropSidebar;
45-
};
46-
}
18+
/* eslint-disable @typescript-eslint/no-use-before-define */
4719

4820
declare module "docusaurus-theme-openapi-docs" {
4921
export type ThemeConfig = Partial<import("./types").ThemeConfig>;

0 commit comments

Comments
 (0)