TypeScript: withMetadata accepts boolean (#3823)

This commit is contained in:
Thomas 2023-10-11 20:38:13 +01:00 committed by GitHub
parent 47e76c9981
commit e6942805b4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 5 deletions

10
lib/index.d.ts vendored
View File

@ -640,7 +640,7 @@ declare namespace sharp {
* @param withMetadata * @param withMetadata
* @throws {Error} Invalid parameters. * @throws {Error} Invalid parameters.
*/ */
withMetadata(withMetadata?: WriteableMetadata): Sharp; withMetadata(withMetadata?: boolean | WriteableMetadata): Sharp;
/** /**
* Use these JPEG options for output image. * Use these JPEG options for output image.
@ -1275,10 +1275,10 @@ declare namespace sharp {
} }
interface NormaliseOptions { interface NormaliseOptions {
/** Percentile below which luminance values will be underexposed. */ /** Percentile below which luminance values will be underexposed. */
lower?: number | undefined; lower?: number | undefined;
/** Percentile above which luminance values will be overexposed. */ /** Percentile above which luminance values will be overexposed. */
upper?: number | undefined; upper?: number | undefined;
} }
interface ResizeOptions { interface ResizeOptions {

View File

@ -659,3 +659,6 @@ sharp('input.tiff').webp({ preset: 'drawing' }).toFile('out.webp');
sharp('input.tiff').webp({ preset: 'text' }).toFile('out.webp'); sharp('input.tiff').webp({ preset: 'text' }).toFile('out.webp');
sharp('input.tiff').webp({ preset: 'default' }).toFile('out.webp'); sharp('input.tiff').webp({ preset: 'default' }).toFile('out.webp');
// Allow a boolean or an object for metadata options.
// https://github.com/lovell/sharp/issues/3822
sharp(input).withMetadata().withMetadata({}).withMetadata(false);