22export default CompressionPlugin ;
33export type Schema = import ( "schema-utils/declarations/validate" ) . Schema ;
44export type Compiler = import ( "webpack" ) . Compiler ;
5+ export type WebpackPluginInstance = import ( "webpack" ) . WebpackPluginInstance ;
56export type Compilation = import ( "webpack" ) . Compilation ;
67export type Source = import ( "webpack" ) . sources . Source ;
78export type Asset = import ( "webpack" ) . Asset ;
89export type WebpackError = import ( "webpack" ) . WebpackError ;
10+ export type WithImplicitCoercion < T > =
11+ | T
12+ | {
13+ valueOf ( ) : T ;
14+ } ;
915export type Rule = RegExp | string ;
1016export type Rules = Rule [ ] | Rule ;
1117export type CustomOptions = {
@@ -16,7 +22,27 @@ export type CompressionOptions<T> = InferDefaultType<T>;
1622export type AlgorithmFunction < T > = (
1723 input : Buffer ,
1824 options : CompressionOptions < T > ,
19- callback : ( error : Error , result : string | Buffer ) => void
25+ callback : (
26+ error : Error | null | undefined ,
27+ result :
28+ | string
29+ | ArrayBuffer
30+ | SharedArrayBuffer
31+ | Uint8Array
32+ | readonly number [ ]
33+ | {
34+ valueOf ( ) : ArrayBuffer | SharedArrayBuffer ;
35+ }
36+ | {
37+ valueOf ( ) : string | Uint8Array | readonly number [ ] ;
38+ }
39+ | {
40+ valueOf ( ) : string ;
41+ }
42+ | {
43+ [ Symbol . toPrimitive ] ( hint : "string" ) : string ;
44+ }
45+ ) => void
2046) => any ;
2147export type PathData = {
2248 [ key : string ] : any ;
@@ -44,10 +70,15 @@ export type InternalPluginOptions<T> = BasePluginOptions<T> & {
4470export type ZlibOptions = import ( "zlib" ) . ZlibOptions ;
4571/** @typedef {import("schema-utils/declarations/validate").Schema } Schema */
4672/** @typedef {import("webpack").Compiler } Compiler */
73+ /** @typedef {import("webpack").WebpackPluginInstance } WebpackPluginInstance */
4774/** @typedef {import("webpack").Compilation } Compilation */
4875/** @typedef {import("webpack").sources.Source } Source */
4976/** @typedef {import("webpack").Asset } Asset */
5077/** @typedef {import("webpack").WebpackError } WebpackError */
78+ /**
79+ * @template T
80+ * @typedef {T | { valueOf(): T } } WithImplicitCoercion
81+ */
5182/** @typedef {RegExp | string } Rule */
5283/** @typedef {Rule[] | Rule } Rules */
5384/**
@@ -66,7 +97,7 @@ export type ZlibOptions = import("zlib").ZlibOptions;
6697 * @callback AlgorithmFunction
6798 * @param {Buffer } input
6899 * @param {CompressionOptions<T> } options
69- * @param {(error: Error, result: string | Buffer ) => void } callback
100+ * @param {(error: Error | null | undefined , result: WithImplicitCoercion<ArrayBuffer | SharedArrayBuffer> | Uint8Array | ReadonlyArray<number> | WithImplicitCoercion<Uint8Array | ReadonlyArray<number> | string> | WithImplicitCoercion<string> | { [Symbol.toPrimitive](hint: 'string'): string } ) => void } callback
70101 */
71102/**
72103 * @typedef {{[key: string]: any} } PathData
@@ -99,8 +130,11 @@ export type ZlibOptions = import("zlib").ZlibOptions;
99130 */
100131/**
101132 * @template [T=ZlibOptions]
133+ * @implements WebpackPluginInstance
102134 */
103- declare class CompressionPlugin < T = import ( "zlib" ) . ZlibOptions > {
135+ declare class CompressionPlugin < T = import ( "zlib" ) . ZlibOptions >
136+ implements WebpackPluginInstance
137+ {
104138 /**
105139 * @param {BasePluginOptions<T> } [options]
106140 */
0 commit comments