Type Issue for Response

This commit is contained in:
Shivam Meena
2022-10-30 01:23:14 +05:30
parent 92a2a663dd
commit a99a17f4c2
5 changed files with 8 additions and 11 deletions

View File

@@ -8,7 +8,7 @@ const resSvgWasm = initWasm(fetch('https://sveltekit-og.ethercorps.io/resvg.wasm
const fontFile = await fetch('https://sveltekit-og.ethercorps.io/noto-sans.ttf');
const fontData: ArrayBuffer = await fontFile.arrayBuffer();
export const ImageResponse = class {
export class ImageResponse {
constructor(htmlTemplate: string, optionsByUser: ImageResponseOptions) {
const options = Object.assign({ width: 1200, height: 630, debug: !1 }, optionsByUser);
const png = new ReadableStream({
@@ -45,14 +45,14 @@ export const ImageResponse = class {
statusText: options.statusText
});
}
};
}
export const componentToImageResponse = class {
export class componentToImageResponse {
constructor(component: typeof SvelteComponent, props = {}, optionsByUser: ImageResponseOptions) {
const htmlTemplate = componentToMarkup(component, props)
return new ImageResponse(htmlTemplate, optionsByUser);
}
};
}
const componentToMarkup = (component: typeof SvelteComponent, props={}) => {
const SvelteRenderedMarkup = (component as any).render(props);