mirror of
https://github.com/lovell/sharp.git
synced 2026-02-04 05:36:18 +01:00
TypeScript: Ensure 'FormatEnum' keys match reality #4475
Renames format.jp2k as format.jp2 for consistency
This commit is contained in:
8
lib/index.d.ts
vendored
8
lib/index.d.ts
vendored
@@ -840,7 +840,7 @@ declare namespace sharp {
|
||||
* @returns A sharp instance that can be used to chain operations
|
||||
*/
|
||||
toFormat(
|
||||
format: keyof FormatEnum | AvailableFormatInfo,
|
||||
format: keyof FormatEnum | AvailableFormatInfo | "avif",
|
||||
options?:
|
||||
| OutputOptions
|
||||
| JpegOptions
|
||||
@@ -1911,16 +1911,13 @@ declare namespace sharp {
|
||||
}
|
||||
|
||||
interface FormatEnum {
|
||||
avif: AvailableFormatInfo;
|
||||
dcraw: AvailableFormatInfo;
|
||||
dz: AvailableFormatInfo;
|
||||
exr: AvailableFormatInfo;
|
||||
fits: AvailableFormatInfo;
|
||||
gif: AvailableFormatInfo;
|
||||
heif: AvailableFormatInfo;
|
||||
input: AvailableFormatInfo;
|
||||
jpeg: AvailableFormatInfo;
|
||||
jpg: AvailableFormatInfo;
|
||||
jp2: AvailableFormatInfo;
|
||||
jxl: AvailableFormatInfo;
|
||||
magick: AvailableFormatInfo;
|
||||
@@ -1932,8 +1929,7 @@ declare namespace sharp {
|
||||
raw: AvailableFormatInfo;
|
||||
svg: AvailableFormatInfo;
|
||||
tiff: AvailableFormatInfo;
|
||||
tif: AvailableFormatInfo;
|
||||
v: AvailableFormatInfo;
|
||||
vips: AvailableFormatInfo;
|
||||
webp: AvailableFormatInfo;
|
||||
}
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ function toFile (fileOut, callback) {
|
||||
err = new Error('Missing output file path');
|
||||
} else if (is.string(this.options.input.file) && path.resolve(this.options.input.file) === path.resolve(fileOut)) {
|
||||
err = new Error('Cannot use same file for input and output');
|
||||
} else if (jp2Regex.test(path.extname(fileOut)) && !this.constructor.format.jp2k.output.file) {
|
||||
} else if (jp2Regex.test(path.extname(fileOut)) && !this.constructor.format.jp2.output.file) {
|
||||
err = errJp2Save();
|
||||
}
|
||||
if (err) {
|
||||
@@ -950,7 +950,7 @@ function gif (options) {
|
||||
*/
|
||||
function jp2 (options) {
|
||||
/* node:coverage ignore next 41 */
|
||||
if (!this.constructor.format.jp2k.output.buffer) {
|
||||
if (!this.constructor.format.jp2.output.buffer) {
|
||||
throw errJp2Save();
|
||||
}
|
||||
if (is.object(options)) {
|
||||
|
||||
@@ -24,7 +24,7 @@ const format = sharp.format();
|
||||
format.heif.output.alias = ['avif', 'heic'];
|
||||
format.jpeg.output.alias = ['jpe', 'jpg'];
|
||||
format.tiff.output.alias = ['tif'];
|
||||
format.jp2k.output.alias = ['j2c', 'j2k', 'jp2', 'jpx'];
|
||||
format.jp2.output.alias = ['j2c', 'j2k', 'jp2', 'jpx'];
|
||||
|
||||
/**
|
||||
* An Object containing the available interpolators and their proper values
|
||||
|
||||
Reference in New Issue
Block a user