mrafiqk/html-pdf-node

Return Type of "generatePdf" Method

Opened this issue · 1 comments

The return type of the "generatePdf" method should be "Buffer" instead of "void":

export function generatePdf(
    file: File,
    options?: Options,
    callback?: (err: Error, buffer: Buffer) => void,
): void // this should be Buffer;

In the current version, the return type is Promise<Buffer>.

This is my workaround for typescript:

const output = await (generatePdf(...) as unknown as Promise<Buffer>);