Skip to content

fix: the current type module path confusing typescript tsc #1216

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
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