statoscope icon indicating copy to clipboard operation
statoscope copied to clipboard

Type Options['compressor'] from webpack-plugin doesn't match with type CompressorOrPreset from stats-extension-compressed

Open Pavel-Liteiniy opened this issue 10 months ago • 0 comments

Describe the bug

Type Options "node_modules/@statoscope/webpack-plugin/dist/index.d.ts"

export type Options = {
    name?: string;
    saveReportTo?: string;
    saveTo?: string;
    saveStatsTo?: string;
    normalizeStats?: boolean;
    saveOnlyStats: boolean;
    disableReportCompression?: boolean;
    additionalStats: string[];
    statsOptions?: Record<string, unknown>;
    watchMode: boolean;
    open: false | 'dir' | 'file';
    compressor: false | 'gzip' | CompressFunction; // <-- there is no type for value like `['gzip', { level: 9 }]`
    reports?: Report<unknown, unknown>[];
    extensions: StatsExtensionWebpackAdapter<unknown>[];
};

But type CompressorOrPreset support it

export type CompressorOrPreset = string | ['gzip', ZlibOptions?] | CompressFunction;

To Reproduce Steps to reproduce the behavior:

new StatoscopeWebpackPlugin({ compressor: ['gzip', { level: 9 }] })

Expected behavior There is no ts error

Screenshots Image

Versions:

  • Node (for non-browser bug): v18.16.0
  • Browser (for browser-bug):
  • Webpack: "webpack": "5.91.0"
  • Statoscope: "@statoscope/webpack-plugin": "5.28.3"
  • Typescript: "typescript": "4.9.5"

Additional context Add any other context about the problem here.

Pavel-Liteiniy avatar Mar 14 '25 14:03 Pavel-Liteiniy