Skip to content

Commit

Permalink
fix: mark props as not required rather than default: undefined (#1450)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe authored Aug 28, 2024
1 parent a36c50c commit 92a6eee
Showing 1 changed file with 24 additions and 24 deletions.
48 changes: 24 additions & 24 deletions src/runtime/components/_base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,54 +5,54 @@ import { useImage } from '#imports'

export const baseImageProps = {
// input source
src: { type: String, default: undefined },
src: { type: String, required: false },

// modifiers
format: { type: String, default: undefined },
quality: { type: [Number, String], default: undefined },
background: { type: String, default: undefined },
fit: { type: String, default: undefined },
modifiers: { type: Object as () => Record<string, any>, default: undefined },
format: { type: String, required: false },
quality: { type: [Number, String], required: false },
background: { type: String, required: false },
fit: { type: String, required: false },
modifiers: { type: Object as () => Record<string, any>, required: false },

// options
preset: { type: String, default: undefined },
provider: { type: String, default: undefined },
preset: { type: String, required: false },
provider: { type: String, required: false },

sizes: { type: [Object, String] as unknown as () => string | Record<string, any>, default: undefined },
densities: { type: String, default: undefined },
sizes: { type: [Object, String] as unknown as () => string | Record<string, any>, required: false },
densities: { type: String, required: false },
preload: {
type: [Boolean, Object] as unknown as () => boolean | {
fetchPriority: 'auto' | 'high' | 'low'
},
default: undefined,
required: false,
},

// <img> attributes
width: { type: [String, Number], default: undefined },
height: { type: [String, Number], default: undefined },
alt: { type: String, default: undefined },
referrerpolicy: { type: String as unknown as () => ImgHTMLAttributes['referrerpolicy'], default: undefined },
usemap: { type: String, default: undefined },
longdesc: { type: String, default: undefined },
ismap: { type: Boolean, default: undefined },
width: { type: [String, Number], required: false },
height: { type: [String, Number], required: false },
alt: { type: String, required: false },
referrerpolicy: { type: String as unknown as () => ImgHTMLAttributes['referrerpolicy'], required: false },
usemap: { type: String, required: false },
longdesc: { type: String, required: false },
ismap: { type: Boolean, required: false },
loading: {
type: String as () => 'lazy' | 'eager',
default: undefined,
required: false,
validator: (val: any) => ['lazy', 'eager'].includes(val),
},
crossorigin: {
type: [Boolean, String] as unknown as () => 'anonymous' | 'use-credentials' | boolean,
default: undefined,
required: false,
validator: (val: any) => ['anonymous', 'use-credentials', '', true, false].includes(val),
},
decoding: {
type: String as () => 'async' | 'auto' | 'sync',
default: undefined,
required: false,
validator: (val: any) => ['async', 'auto', 'sync'].includes(val),
},

// csp
nonce: { type: [String], default: undefined },
nonce: { type: [String], required: false },
}

export interface BaseImageAttrs {
Expand Down Expand Up @@ -132,6 +132,6 @@ export const pictureProps = {

export const imgProps = {
...baseImageProps,
placeholder: { type: [Boolean, String, Number, Array], default: undefined },
placeholderClass: { type: String, default: undefined },
placeholder: { type: [Boolean, String, Number, Array], required: false },
placeholderClass: { type: String, required: false },
}

0 comments on commit 92a6eee

Please sign in to comment.