Skip to content
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

fix: 🐛 less ambigious plugin types #4540

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
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 interface NamedPlugin<T, D = void> extends PluginBase<T, D>, PluginNameVersion {}

/**
* A plugin that is registered by its package.json file.
*/
export interface PackagedPlugin<T, D = void> extends 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