terser-webpack-plugin: Small type error in terserOptions
after upgrading to the latest 5.2.2 (thanks for that other fix) i do see another small issue
error TS2345: Argument of type '{ parallel: true; terserOptions: { compress: { dead_code: boolean;
pure_funcs: string[]; }; mangle: boolean; }; }' is not assignable to parameter of type
'BasePluginOptions & { minify: MinimizerImplementation<unknown>; terserOptions?: unknown; }'.
Property 'minify' is missing in type '{ parallel: true; terserOptions: { compress:
{ dead_code: boolean; pure_funcs: string[]; }; mangle: boolean; }; }' but required in
type '{ minify: MinimizerImplementation<unknown>; terserOptions?: unknown; }'.
(alias) new TerserPlugin<unknown>(options?: (BasePluginOptions & {
minify: MinimizerImplementation<unknown>;
terserOptions?: unknown;
}) | undefined): TerserPlugin<unknown>
import TerserPlugin
I think this is caused by the second minify not being optional (?)
export type DefinedDefaultMinimizerAndOptions<T> =
InferDefaultType<T> extends TerserOptions
? {
minify?: MinimizerImplementation<InferDefaultType<T>> | undefined;
terserOptions?: InferDefaultType<T> | undefined;
}
: {
minify: MinimizerImplementation<InferDefaultType<T>>;
terserOptions?: InferDefaultType<T> | undefined;
};
thanks
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 32 (18 by maintainers)
Can confirm that the typings error I posted is also gone. Both ways, using
TerserPlugin.terserMinify
and namedterserMinify
import now get accepted by TS compiler asminify
prop ofTerserPlugin
constructor.You don’t need
@types/terser-webpack-plugin
, types are built-inAll good, thanks for your quick action !
I’m here to speed up the process the way I’m ready at the moment. Not the one who placed the original issue.