Skip to content

Commit

Permalink
feat(cloudinary): add types for options and modifiers (#511)
Browse files Browse the repository at this point in the history
* feat(types-cloudinary-options): Added type support for cloudinary provider options.

* feat(types-cloudinary-options): fix type CloudinaryModifiers extending ImageModifiers

* Types match and properly extend from ImageModifiers.
  • Loading branch information
PawFV committed Jun 21, 2022
1 parent 415757a commit 79c1580
Showing 1 changed file with 29 additions and 2 deletions.
31 changes: 29 additions & 2 deletions src/types/module.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { IPXOptions } from 'ipx'
import type { ImageOptions, CreateImageOptions } from './image'
import type { ImageOptions, CreateImageOptions, ImageModifiers } from './image'

// eslint-disable-next-line no-use-before-define
export type ProviderSetup = (providerOptions: ImageModuleProvider, moduleOptions: ModuleOptions, nuxt: any)
Expand All @@ -12,8 +12,35 @@ export interface InputProvider<T = any> {
setup?: ProviderSetup
}

export interface CloudinaryModifiers extends ImageModifiers {
format: string
quality: string
background: string
rotate: 'auto_right' | 'auto_left' | 'ignore' | 'vflip' | 'hflip' | number
roundCorner: string
gravity: string
effect: string
color: string
flags: string
dpr: string
opacity: number
overlay: string
underlay: string
transformation: string
zoom: number
colorSpace: string
customFunc: string
density: number
}

export interface CloudinaryOptions {
baseURL: string
modifiers: Partial<CloudinaryModifiers>
[key: string]: any
}

export interface ImageProviders {
cloudinary?: any
cloudinary?: Partial<CloudinaryOptions>
contentful?: any
fastly?: any
glide?: any
Expand Down

0 comments on commit 79c1580

Please sign in to comment.