diff --git a/types/imagemin/imagemin-tests.ts b/types/imagemin/imagemin-tests.ts new file mode 100644 index 0000000000..1cc39cdfe2 --- /dev/null +++ b/types/imagemin/imagemin-tests.ts @@ -0,0 +1,10 @@ +import * as Imagemin from 'imagemin'; + +const input = ['fileA.jpg', 'fileB.png']; +const output = 'output'; +const options = { plugins: [] }; + +Imagemin(input); +Imagemin(input, output); +Imagemin(input, options); +Imagemin(input, output, options); diff --git a/types/imagemin/index.d.ts b/types/imagemin/index.d.ts new file mode 100644 index 0000000000..531d2d54ab --- /dev/null +++ b/types/imagemin/index.d.ts @@ -0,0 +1,25 @@ +// Type definitions for imagemin 6.0 +// Project: https://github.com/imagemin/imagemin#readme +// Definitions by: Romain Faust +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare function imagemin(input: string[], outputOrOptions?: string | imagemin.Options, options?: imagemin.Options): Promise; + +declare namespace imagemin { + function buffer(buffer: Buffer, options?: Options): Promise; + + type Plugin = (input: Buffer) => Promise; + + interface Options { + plugins: Plugin[]; + } + + interface Result { + data: Buffer; + path: string; + } +} + +export = imagemin; diff --git a/types/imagemin/tsconfig.json b/types/imagemin/tsconfig.json new file mode 100644 index 0000000000..849754b4d0 --- /dev/null +++ b/types/imagemin/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", + "imagemin-tests.ts" + ] +} diff --git a/types/imagemin/tslint.json b/types/imagemin/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/imagemin/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }