Skip to content

Commit

Permalink
fix: πŸ› less ambigious plugin types
Browse files Browse the repository at this point in the history
  • Loading branch information
damusix committed Jan 20, 2025
1 parent 9aa775f commit 500628d
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion lib/types/plugin.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,17 @@ export interface PluginBase<T, D> {
___$type_of_plugin_decorations$___?: D;
}

/**
* A plugin that is registered by name and version.
*/
export type NamedPlugin<T, D = void> = PluginBase<T, D> & PluginNameVersion;

/**
* A plugin that is registered by its package.json file.
*/
export type PackagedPlugin<T, D = void> = PluginBase<T, D> & PluginPackage;


/**
* Plugins provide a way to organize application code by splitting the server logic into smaller components. Each
* plugin can manipulate the server through the standard server interface, but with the added ability to sandbox
Expand All @@ -116,7 +127,7 @@ export interface PluginBase<T, D> {
*
* The type T is the type of the plugin options.
*/
export type Plugin<T, D = void> = PluginBase<T, D> & (PluginNameVersion | PluginPackage);
export type Plugin<T, D = void> = NamedPlugin<T, D> | PackagedPlugin<T, D>;

/**
* The realm object contains sandboxed server settings specific to each plugin or authentication strategy. When registering a plugin or an authentication scheme, a server object reference is provided
Expand Down

0 comments on commit 500628d

Please sign in to comment.