diff --git a/lib/decoders/fast-png/PNGDecoder.ts b/lib/decoders/fast-png/PNGDecoder.ts index 4cd0594..eae0df7 100644 --- a/lib/decoders/fast-png/PNGDecoder.ts +++ b/lib/decoders/fast-png/PNGDecoder.ts @@ -3,13 +3,14 @@ import { IOBuffer } from './iobuffer/IOBuffer.ts'; import { Inflate as Inflator } from './pako/index.js'; import { pngSignature, crc } from './common.ts'; -import { +import type { IDecodedPNG, DecoderInputType, IPNGDecoderOptions, PNGDataArray, IndexedColors, BitDepth, + IInflator } from './types.ts'; import { ColorType, @@ -27,7 +28,7 @@ const osIsLittleEndian = uint8[0] === 0xff; export default class PNGDecoder extends IOBuffer { private _checkCrc: boolean; - private _inflator: typeof Inflator; + private _inflator: IInflator; private _png: IDecodedPNG; private _end: boolean; private _hasPalette: boolean; @@ -41,7 +42,7 @@ export default class PNGDecoder extends IOBuffer { super(data); const { checkCrc = false } = options; this._checkCrc = checkCrc; - this._inflator = new Inflator(); + this._inflator = new Inflator(); this._png = { width: -1, height: -1, diff --git a/lib/decoders/fast-png/PNGEncoder.ts b/lib/decoders/fast-png/PNGEncoder.ts index c10f6a0..0ffbb42 100644 --- a/lib/decoders/fast-png/PNGEncoder.ts +++ b/lib/decoders/fast-png/PNGEncoder.ts @@ -101,7 +101,7 @@ export default class PNGEncoder extends IOBuffer { } } const buffer = newData.toArray(); - const compressed = deflate(buffer, this._zlibOptions); + const compressed = deflate(buffer, this._zlibOptions); this.encodeIDAT(compressed); } diff --git a/lib/decoders/fast-png/types.ts b/lib/decoders/fast-png/types.ts index 811e90c..59f6ac3 100644 --- a/lib/decoders/fast-png/types.ts +++ b/lib/decoders/fast-png/types.ts @@ -79,3 +79,12 @@ export interface IPNGEncoderOptions { } export type IndexedColors = number[][]; + +export interface IInflator { + result: Uint8Array | Array | string; + err: number; + msg: string; + push: Function; + onData: Function; + onEnd: Function; +}