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

feat(types): add generic type for plugin api #5112

Merged
merged 1 commit into from
Aug 30, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/rollup/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ export type WatchChangeHook = (
* ```
*/
// eslint-disable-next-line @typescript-eslint/ban-types
export type PluginImpl<O extends object = object> = (options?: O) => Plugin;
export type PluginImpl<O extends object = object, A = any> = (options?: O) => Plugin<A>;

export interface OutputBundle {
[fileName: string]: OutputAsset | OutputChunk;
Expand Down Expand Up @@ -497,9 +497,9 @@ export interface OutputPlugin
version?: string;
}

export interface Plugin extends OutputPlugin, Partial<PluginHooks> {
export interface Plugin<A = any> extends OutputPlugin, Partial<PluginHooks> {
// for inter-plugin communication
api?: any;
api?: A;
}

type TreeshakingPreset = 'smallest' | 'safest' | 'recommended';
Expand Down