Skip to content

Commit

Permalink
feat(types): add generic type for plugin api (#5112)
Browse files Browse the repository at this point in the history
feat(types): add generic for plugin api
  • Loading branch information
sxzz authored Aug 30, 2023
1 parent 1e81f94 commit bb6bfa7
Showing 1 changed file with 3 additions and 3 deletions.
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

0 comments on commit bb6bfa7

Please sign in to comment.