Merge pull request #28213 from wooseopkim/master

[sharp] Fix #28100: make the first argument omitable
This commit is contained in:
Daniel Rosenwasser
2018-08-21 13:57:52 -07:00
committed by GitHub
2 changed files with 12 additions and 0 deletions
+1
View File
@@ -15,6 +15,7 @@ import { Duplex } from "stream";
* @throws {Error} Invalid parameters
* @returns A sharp instance that can be used to chain operations
*/
declare function sharp(options?: sharp.SharpOptions): sharp.SharpInstance;
declare function sharp(input?: string | Buffer, options?: sharp.SharpOptions): sharp.SharpInstance;
declare namespace sharp {
const gravity: GravityEnum;
+11
View File
@@ -47,6 +47,17 @@ sharp('input.jpg')
// containing a scaled and cropped version of input.jpg
});
sharp({
create: {
width: 300,
height: 200,
channels: 4,
background: { r: 255, g: 0, b: 0, alpha: 128 }
}
})
.png()
.toBuffer();
let transformer = sharp()
.resize(300)
.on('info', (info: sharp.OutputInfo) => {