Merge pull request #28284 from romain-faust/imagemin

[@types/imagemin] Add type definitions
This commit is contained in:
Daniel Rosenwasser
2018-08-24 13:47:25 -07:00
committed by GitHub
4 changed files with 59 additions and 0 deletions
+9
View File
@@ -0,0 +1,9 @@
import imagemin = require('imagemin');
imagemin(['*.png']).then((results: imagemin.Result[]) => { /* ... */ });
imagemin(['*.png'], 'dist').then((results: imagemin.Result[]) => { /* ... */ });
imagemin(['*.png'], { plugins: [] }).then((results: imagemin.Result[]) => { /* ... */ });
imagemin(['*.png'], 'dist', { plugins: [] }).then((results: imagemin.Result[]) => { /* ... */ });
imagemin.buffer(Buffer.from([/* ... */])).then((result: Buffer) => { /* ... */ });
imagemin.buffer(Buffer.from([/* ... */]), { plugins: [] }).then((result: Buffer) => { /* ... */ });
+26
View File
@@ -0,0 +1,26 @@
// Type definitions for imagemin 6.0
// Project: https://github.com/imagemin/imagemin#readme
// Definitions by: Romain Faust <https://github.com/romain-faust>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
declare function imagemin(input: ReadonlyArray<string>, outputOrOptions?: string | imagemin.Options): Promise<imagemin.Result[]>;
declare function imagemin(input: ReadonlyArray<string>, output?: string, options?: imagemin.Options): Promise<imagemin.Result[]>;
declare namespace imagemin {
type Plugin = (input: Buffer) => Promise<Buffer>;
interface Options {
plugins: ReadonlyArray<Plugin>;
}
interface Result {
data: Buffer;
path: string;
}
function buffer(buffer: Buffer, options?: Options): Promise<Buffer>;
}
export = imagemin;
+23
View File
@@ -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"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }