From 010136012882e6409764cbda9d9a0a6d118480c0 Mon Sep 17 00:00:00 2001 From: Alan Agius Date: Sun, 25 Mar 2018 13:06:31 +0200 Subject: [PATCH 1/2] fix: `shebang` should be optional in `ParseOptions` --- types/uglify-js/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/uglify-js/index.d.ts b/types/uglify-js/index.d.ts index cab53cb4db..12bcefa7af 100644 --- a/types/uglify-js/index.d.ts +++ b/types/uglify-js/index.d.ts @@ -10,7 +10,7 @@ export interface ParseOptions { bare_returns?: boolean; html5_comments?: boolean; /** Support `#!command` as the first line */ - shebang: boolean; + shebang?: boolean; } export interface CompressOptions { From d18f4a1d002538fd53a44d109c152879170f6f99 Mon Sep 17 00:00:00 2001 From: Alan Agius Date: Sun, 25 Mar 2018 13:16:16 +0200 Subject: [PATCH 2/2] fix: add `warnings` to `MinifyOutput` --- types/uglify-js/index.d.ts | 1 + types/uglify-js/uglify-js-tests.ts | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/types/uglify-js/index.d.ts b/types/uglify-js/index.d.ts index 12bcefa7af..eca756bd53 100644 --- a/types/uglify-js/index.d.ts +++ b/types/uglify-js/index.d.ts @@ -198,6 +198,7 @@ export interface MinifyOptions { export interface MinifyOutput { error?: Error; + warnings?: string[]; code: string; map: string; } diff --git a/types/uglify-js/uglify-js-tests.ts b/types/uglify-js/uglify-js-tests.ts index 6b146ab0e7..19c11dfdf1 100644 --- a/types/uglify-js/uglify-js-tests.ts +++ b/types/uglify-js/uglify-js-tests.ts @@ -20,7 +20,7 @@ minify(code, { } }); -minify(code, { +const output = minify(code, { warnings: 'verbose', mangle: { properties: { @@ -34,3 +34,7 @@ minify(code, { arguments: true } }); + +if (output.warnings) { + output.warnings.filter(x => x === 'Dropping unused variable'); +}