fix(api): support sharp 0.35 types

This commit is contained in:
SnapOtter
2026-06-29 16:09:30 +08:00
parent 49c6e44ce3
commit 6f85b3d12a
11 changed files with 23 additions and 23 deletions
+2 -2
View File
@@ -1,4 +1,4 @@
import sharp from "sharp";
import sharp, { type Sharp } from "sharp";
export type BgOutputFormat = "png" | "webp" | "avif";
@@ -10,7 +10,7 @@ export const BG_FORMAT_CONTENT_TYPES: Record<BgOutputFormat, string> = {
avif: "image/avif",
};
function toOutputFormat(pipeline: sharp.Sharp, format: BgOutputFormat): Promise<Buffer> {
function toOutputFormat(pipeline: Sharp, format: BgOutputFormat): Promise<Buffer> {
switch (format) {
case "webp":
return pipeline.webp({ lossless: true }).toBuffer();
+2 -2
View File
@@ -1,6 +1,6 @@
import sharp from "sharp";
import sharp, { type FormatEnum } from "sharp";
type SharpFormat = keyof sharp.FormatEnum | "avif";
export type SharpFormat = Extract<keyof FormatEnum, string> | "avif";
export interface OutputFormat {
format: SharpFormat;