Skip to content

Export FlatMetadata type #930

Description

@solonovamax

it would be great if you could export the FlatMetadata type:

/**
* The flat object emitted by the `as=metadata` output format: the raw sharp
* metadata of the image combined with the final output `width`, `height` and
* `format`, plus the image URL. The applied-transform directives are not
* included, since they cannot be reconstructed from a cached file, keeping the
* output identical between cache hits and misses.
*/
type FlatMetadata = Omit<Metadata, 'format'> & {
format: string
src: string
}

I'd like to be able to use this for a typescript module declaration:

declare module "*as=metadata" {
    import {FlatMetadata} from "imagetools-core";
    const value: FlatMetadata | FlatMetadata[];
    export default value;
}

declare module "*as=meta" {
    import {FlatMetadata} from "imagetools-core";
    const value: FlatMetadata | FlatMetadata[];
    export default value;
}

however, because it's not exported currently, I need to vendor the type.

also, it would be great if the flatten function could also be exported, as I have my own custom output format which previously used Metadata from sharp (similar to how this package used to), but I'd like to replace it with FlatMetadata.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions