mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
type definitions for imagemin 7.0 (#38199)
* Update definition to imagemin v7 * Update index.d.ts * update to fix test and lint * use buffer options * for not breaking other package test * fix related test so that destination is no longer optional * Revert "fix related test so that destination is no longer optional" This reverts commit 5ec10f750a3ed1f50a46d7cf67084586ee2def5a.
This commit is contained in:
parent
156a7ab7e1
commit
3deeea18a5
@ -1,9 +1,6 @@
|
||||
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(['*.png'], { destination: 'dist', plugins: [] }).then((results: imagemin.Result[]) => { /* ... */ });
|
||||
|
||||
imagemin.buffer(Buffer.from([/* ... */])).then((result: Buffer) => { /* ... */ });
|
||||
imagemin.buffer(Buffer.from([/* ... */]), { plugins: [] }).then((result: Buffer) => { /* ... */ });
|
||||
|
||||
17
types/imagemin/index.d.ts
vendored
17
types/imagemin/index.d.ts
vendored
@ -1,26 +1,33 @@
|
||||
// Type definitions for imagemin 6.0
|
||||
// Type definitions for imagemin 7.0
|
||||
// Project: https://github.com/imagemin/imagemin#readme
|
||||
// Definitions by: Romain Faust <https://github.com/romain-faust>
|
||||
// Jeff Chan <https://github.com/hkjeffchan>
|
||||
// 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 function imagemin(input: ReadonlyArray<string>, options?: imagemin.Options): Promise<imagemin.Result[]>;
|
||||
|
||||
declare namespace imagemin {
|
||||
type Plugin = (input: Buffer) => Promise<Buffer>;
|
||||
|
||||
interface Options {
|
||||
destination?: string;
|
||||
plugins: ReadonlyArray<Plugin>;
|
||||
glob?: boolean;
|
||||
}
|
||||
|
||||
interface Result {
|
||||
data: Buffer;
|
||||
path: string;
|
||||
sourcePath: string;
|
||||
destinationPath: string;
|
||||
}
|
||||
|
||||
function buffer(buffer: Buffer, options?: Options): Promise<Buffer>;
|
||||
interface BufferOptions {
|
||||
plugins: ReadonlyArray<Plugin>;
|
||||
}
|
||||
|
||||
function buffer(buffer: Buffer, options?: BufferOptions): Promise<Buffer>;
|
||||
}
|
||||
|
||||
export = imagemin;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user