Open Eptagone opened 9 months ago
Found this issue too.. Any solution?
Hey there, author here. I'm so sorry, but I know NOTHING about TypeScript. I am a native JavaScript developer. However, I asked ChatGPT 4 to help:
https://chatgpt.com/share/dae297ec-445c-492b-96ad-5f32f2ae2e95
The file it produced seems okay to me, so I'm going to just go ahead and check it in, and then will publish a new revision of the library. I apologize, but I have no idea how to even verify it works. As I said, I'm not a TypeScript dev, so this is all foreign to me.
I'll leave this issue open.
Released v1.0.5 with ChatGPT's webp-wasm.d.ts
file included:
https://github.com/jhuckaby/webp-wasm/blob/main/webp-wasm.d.ts
Thank you! Funny, i'am using TypeScript and know nothing about pure js except 9+"1"==="91"
meme.
Also i checked almost the same request to claude.ai, its answered with additional callback related things:
declare module 'webp-wasm' {
export interface ImageData {
data: Uint8ClampedArray;
width: number;
height: number;
}
export interface EncodeOptions {
// skipped..
}
export function load(): Promise<void>;
export function decode(buffer: Buffer | ArrayBuffer): Promise<ImageData>;
export function encode(imgData: ImageData, options?: EncodeOptions): Promise<Buffer>;
// For users who prefer callback-style:
export function load(callback: (err: Error | null) => void): void;
export function decode(buffer: Buffer | ArrayBuffer, callback: (err: Error | null, imgData: ImageData) => void): void;
export function encode(imgData: ImageData, options: EncodeOptions, callback: (err: Error | null, buffer: Buffer) => void): void;
}
@jhuckaby Checked 1.0.5, looks like you forgot "types": "webp-wasm.d.ts"
in package.json
, isn't ?
Thank you, @a0s. I will add these changes. I had no idea that I needed something in package.json
for defining types.
Hi. I'm looking for a WebP library to use it in my TypeScript project. I just discovered this one but the package doesn't have type definitions files so it can't be used in TypeScript projects yet. It'd be so nice adding type definitions to the project.
The following errors appear because that.