Skip to content

Commit

Permalink
add missing plugins generic types
Browse files Browse the repository at this point in the history
  • Loading branch information
slorber committed Jun 25, 2021
1 parent e0ee72f commit 9c08bb6
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packages/docusaurus-types/src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ export type AllContent = Record<
// TODO improve type (not exposed by postcss-loader)
export type PostCssOptions = Record<string, unknown> & {plugins: unknown[]};

export interface Plugin<Content> {
export interface Plugin<Content = unknown> {
name: string;
loadContent?(): Promise<Content>;
contentLoaded?({
Expand Down Expand Up @@ -283,12 +283,14 @@ export interface Plugin<Content> {
}): ThemeConfig;
}

export type InitializedPlugin = Plugin<unknown> & {
export type InitializedPlugin<Content = unknown> = Plugin<Content> & {
readonly options: PluginOptions;
readonly version: DocusaurusPluginVersionInformation;
};

export type LoadedPlugin = InitializedPlugin & {readonly content: unknown};
export type LoadedPlugin<Content = unknown> = InitializedPlugin<Content> & {
readonly content: Content;
};

export type PluginModule = {
<T, X>(context: LoadContext, options: T): Plugin<X>;
Expand Down

0 comments on commit 9c08bb6

Please sign in to comment.