meo-canvas - v8.0.0
    Preparing search index...

    Type Alias RenderedCanvas

    RenderedCanvas: Omit<
        Canvas,
        "toBuffer"
        | "toBufferSync"
        | "toURL"
        | "toURLSync"
        | "toDataURLSync",
    > & {
        toBuffer(
            format: AnimatedFormat,
            options?: ExportOptions & AnimationExportOptions,
        ): Promise<Buffer<ArrayBufferLike>>;
        toBuffer(
            format: StillFormat,
            options?: StillExportOptions,
        ): Promise<Buffer<ArrayBufferLike>>;
        toBufferSync(
            format: AnimatedFormat,
            options?: ExportOptions & AnimationExportOptions,
        ): Buffer;
        toBufferSync(format: StillFormat, options?: StillExportOptions): Buffer;
        toDataURLSync(
            format: AnimatedFormat,
            options?: ExportOptions & AnimationExportOptions,
        ): string;
        toDataURLSync(format: StillFormat, options?: StillExportOptions): string;
        toURL(
            format: AnimatedFormat,
            options?: ExportOptions & AnimationExportOptions,
        ): Promise<string>;
        toURL(format: StillFormat, options?: StillExportOptions): Promise<string>;
        toURLSync(
            format: AnimatedFormat,
            options?: ExportOptions & AnimationExportOptions,
        ): string;
        toURLSync(format: StillFormat, options?: StillExportOptions): string;
    }

    The renderer's own Canvas, with its exports narrowed by format.

    A non-worker render hands back the real canvas, whose toBuffer accepts any format with any options — so toBuffer('png', { fps: 30 }) compiled there while the identical call through WorkerCanvas did not. The same mistake was a compile error or a runtime TypeError depending only on which mode the render happened to use.

    This is that narrowing, and nothing else: the object handed back is unchanged, every other member is reachable, and a real Canvas is assignable to it.

    Type Declaration