Skip to content

Commit

Permalink
fix: types for optional peer dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-akait authored Sep 2, 2021
1 parent c6dc40d commit 7577b43
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 15 deletions.
10 changes: 5 additions & 5 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ import { minify as minimize } from "./minify";
/** @typedef {import("webpack").Compilation} Compilation */
/** @typedef {import("webpack").WebpackError} WebpackError */
/** @typedef {import("webpack").Asset} Asset */
/** @typedef {import("terser").ECMA} TerserECMA */
/** @typedef {import("terser").MinifyOptions} TerserOptions */
/** @typedef {import("uglify-js").MinifyOptions} UglifyJSOptions */
/** @typedef {import("@swc/core").JsMinifyOptions} SwcOptions */
/** @typedef {import("esbuild").TransformOptions} EsbuildOptions */
/** @typedef {import("./utils.js").TerserECMA} TerserECMA */
/** @typedef {import("./utils.js").TerserOptions} TerserOptions */
/** @typedef {import("./utils.js").UglifyJSOptions} UglifyJSOptions */
/** @typedef {import("./utils.js").SwcOptions} SwcOptions */
/** @typedef {import("./utils.js").EsbuildOptions} EsbuildOptions */
/** @typedef {Object.<any, any>} CustomOptions */
/** @typedef {import("jest-worker").Worker} JestWorker */
/** @typedef {import("source-map").RawSourceMap} RawSourceMap */
Expand Down
2 changes: 2 additions & 0 deletions src/utils.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/** @typedef {import("source-map").RawSourceMap} RawSourceMap */
/** @typedef {import("terser").FormatOptions} TerserFormatOptions */
/** @typedef {import("terser").MinifyOptions} TerserOptions */
/** @typedef {import("terser").ECMA} TerserECMA */
// TODO do not forget to add `// @ts-ignore` on optional peer dependencies to avoid problem with `TS2307: Cannot find module 'module' or its corresponding type declarations.`
/** @typedef {import("uglify-js").OutputOptions} UglifyJSOutputOptions */
/** @typedef {import("uglify-js").MinifyOptions} UglifyJSOptions */
/** @typedef {import("@swc/core").JsMinifyOptions} SwcOptions */
Expand Down
20 changes: 10 additions & 10 deletions types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ export type Compiler = import("webpack").Compiler;
export type Compilation = import("webpack").Compilation;
export type WebpackError = import("webpack").WebpackError;
export type Asset = import("webpack").Asset;
export type TerserECMA = import("terser").ECMA;
export type TerserOptions = import("terser").MinifyOptions;
export type UglifyJSOptions = import("uglify-js").MinifyOptions;
export type SwcOptions = import("@swc/core").JsMinifyOptions;
export type EsbuildOptions = import("esbuild").TransformOptions;
export type TerserECMA = import("./utils.js").TerserECMA;
export type TerserOptions = import("./utils.js").TerserOptions;
export type UglifyJSOptions = import("./utils.js").UglifyJSOptions;
export type SwcOptions = import("./utils.js").SwcOptions;
export type EsbuildOptions = import("./utils.js").EsbuildOptions;
export type CustomOptions = any;
export type JestWorker = import("jest-worker").Worker;
export type RawSourceMap = import("source-map").RawSourceMap;
Expand Down Expand Up @@ -119,11 +119,11 @@ export type PickMinimizerImplementationAndOptions<T> =
/** @typedef {import("webpack").Compilation} Compilation */
/** @typedef {import("webpack").WebpackError} WebpackError */
/** @typedef {import("webpack").Asset} Asset */
/** @typedef {import("terser").ECMA} TerserECMA */
/** @typedef {import("terser").MinifyOptions} TerserOptions */
/** @typedef {import("uglify-js").MinifyOptions} UglifyJSOptions */
/** @typedef {import("@swc/core").JsMinifyOptions} SwcOptions */
/** @typedef {import("esbuild").TransformOptions} EsbuildOptions */
/** @typedef {import("./utils.js").TerserECMA} TerserECMA */
/** @typedef {import("./utils.js").TerserOptions} TerserOptions */
/** @typedef {import("./utils.js").UglifyJSOptions} UglifyJSOptions */
/** @typedef {import("./utils.js").SwcOptions} SwcOptions */
/** @typedef {import("./utils.js").EsbuildOptions} EsbuildOptions */
/** @typedef {Object.<any, any>} CustomOptions */
/** @typedef {import("jest-worker").Worker} JestWorker */
/** @typedef {import("source-map").RawSourceMap} RawSourceMap */
Expand Down
6 changes: 6 additions & 0 deletions types/utils.d.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
export type RawSourceMap = import("source-map").RawSourceMap;
export type TerserFormatOptions = import("terser").FormatOptions;
export type TerserOptions = import("terser").MinifyOptions;
export type TerserECMA = import("terser").ECMA;
// @ts-ignore
export type UglifyJSOutputOptions = import("uglify-js").OutputOptions;
// @ts-ignore
export type UglifyJSOptions = import("uglify-js").MinifyOptions;
// @ts-ignore
export type SwcOptions = import("@swc/core").JsMinifyOptions;
// @ts-ignore
export type EsbuildOptions = import("esbuild").TransformOptions;
export type ExtractCommentsOptions =
import("./index.js").ExtractCommentsOptions;
Expand Down Expand Up @@ -42,6 +47,7 @@ export type ExtractedComments = Array<string>;
/** @typedef {import("source-map").RawSourceMap} RawSourceMap */
/** @typedef {import("terser").FormatOptions} TerserFormatOptions */
/** @typedef {import("terser").MinifyOptions} TerserOptions */
/** @typedef {import("terser").ECMA} TerserECMA */
/** @typedef {import("uglify-js").OutputOptions} UglifyJSOutputOptions */
/** @typedef {import("uglify-js").MinifyOptions} UglifyJSOptions */
/** @typedef {import("@swc/core").JsMinifyOptions} SwcOptions */
Expand Down

0 comments on commit 7577b43

Please sign in to comment.