Skip to content

Commit bb6bfa7

Browse files
authored
feat(types): add generic type for plugin api (#5112)
feat(types): add generic for plugin api
1 parent 1e81f94 commit bb6bfa7

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/rollup/types.d.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ export type WatchChangeHook = (
369369
* ```
370370
*/
371371
// eslint-disable-next-line @typescript-eslint/ban-types
372-
export type PluginImpl<O extends object = object> = (options?: O) => Plugin;
372+
export type PluginImpl<O extends object = object, A = any> = (options?: O) => Plugin<A>;
373373

374374
export interface OutputBundle {
375375
[fileName: string]: OutputAsset | OutputChunk;
@@ -497,9 +497,9 @@ export interface OutputPlugin
497497
version?: string;
498498
}
499499

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

505505
type TreeshakingPreset = 'smallest' | 'safest' | 'recommended';

0 commit comments

Comments
 (0)