image icon indicating copy to clipboard operation
image copied to clipboard

Support custom provider modifiers in interface

Open nathanchase opened this issue 7 months ago • 0 comments

The change in v2.0.0-alpha.1 to src/types/image.ts caused any modifiers that any of the custom providers offer (including ipx) for things like "sharpen" or "grayscale".

IPX alone has many modifiers:

export interface IPXModifiers extends Omit<ImageModifiers, 'fit' | 'format' | 'blur'> {
  format: 'jpeg' | 'jpg' | 'png' | 'webp' | 'avif' | 'gif' | 'heif' | 'tiff' | 'auto' | string & {}
  fit: 'contain' | 'cover' | 'fill' | 'inside' | 'outside' | string & {}
  resize: string
  quality: number | string
  background: string
  position: string
  enlarge: true | 'true'
  kernel: 'nearest' | 'cubic' | 'mitchell' | 'lanczos2' | 'lanczos3' | string & {}
  trim: number | string
  extend: string
  extract: string
  rotate: number | string
  flip: true | 'true'
  flop: true | 'true'
  sharpen: number | string
  median: number | string
  blur: number | string
  flatten: true | 'true'
  gamma: string
  negate: true | 'true'
  normalize: true | 'true'
  threshold: number | string
  modulate: string
  tint: number | string
  grayscale: true | 'true'
  animated: true | 'true'
}

but if you were to try to use any of these modifiers with the useImage() composable, the typing does not exist for them.

Image

Now, I'm not sure if this is a limitation of the existing typing, or something not hooked up for useImage() specifically to be able to have typing for all of the modifiers of all the various providers.

nathanchase avatar May 16 '25 01:05 nathanchase