Skip to content

How do I actually use a locally defined provider without contributing it to unpic? #169

@yacoob

Description

@yacoob

I'm about 80% sure this is not an actual bug, but rather the fact that my knowledge of typescript is very patchy. Please bear with me :)

context: I wanted to add my own local provider to unpic. I have an endpoint that produces thumbnails on the fly, accepting just width and height from the url and rescaling the image. In prod, my images live on imagekit; this provider would handle things in the dev environment.

I've followed the instructions and made my own subclass of Operations, Options, generator and parser for Operations. I'm struggling with defining an URLExtractor<"local">, as the parametrized type is the ImageCdn union defined in unpic itself. I can't seem to be able to modify it via typescript module augmentation - I'm either using it incorrectly or there's something missing.

Would you please be able to add a minimal example of this to the documentation? Or add it here, and I'll happily update the docs :)

Thanks!

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