From 19493d0fb16f8d86d2935d897b3d1450e0e92a46 Mon Sep 17 00:00:00 2001 From: Hirotaka Ikoma Date: Sat, 21 Apr 2018 02:40:03 +0900 Subject: [PATCH] Add type definitions for pngquant-bin (#25159) --- types/pngquant-bin/index.d.ts | 9 +++++++++ types/pngquant-bin/pngquant-bin-tests.ts | 6 ++++++ types/pngquant-bin/tsconfig.json | 23 +++++++++++++++++++++++ types/pngquant-bin/tslint.json | 1 + 4 files changed, 39 insertions(+) create mode 100644 types/pngquant-bin/index.d.ts create mode 100644 types/pngquant-bin/pngquant-bin-tests.ts create mode 100644 types/pngquant-bin/tsconfig.json create mode 100644 types/pngquant-bin/tslint.json diff --git a/types/pngquant-bin/index.d.ts b/types/pngquant-bin/index.d.ts new file mode 100644 index 0000000000..928ef83333 --- /dev/null +++ b/types/pngquant-bin/index.d.ts @@ -0,0 +1,9 @@ +// Type definitions for pngquant-bin 4.0 +// Project: https://github.com/imagemin/pngquant-bin#readme +// Definitions by: Hirotaka Ikoma +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare const pngquant: string; +export = pngquant; diff --git a/types/pngquant-bin/pngquant-bin-tests.ts b/types/pngquant-bin/pngquant-bin-tests.ts new file mode 100644 index 0000000000..40f79d1371 --- /dev/null +++ b/types/pngquant-bin/pngquant-bin-tests.ts @@ -0,0 +1,6 @@ +import { execFile } from "child_process"; +import * as pngquant from "pngquant-bin"; + +execFile(pngquant, ["-o", "output.png", "input.png"], { encoding: "utf-8" }, (err: Error | null) => { + console.log("Image minified!"); +}); diff --git a/types/pngquant-bin/tsconfig.json b/types/pngquant-bin/tsconfig.json new file mode 100644 index 0000000000..770ff62c3f --- /dev/null +++ b/types/pngquant-bin/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "pngquant-bin-tests.ts" + ] +} diff --git a/types/pngquant-bin/tslint.json b/types/pngquant-bin/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/pngquant-bin/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }