Skip to content

Commit

Permalink
fix(gatsby-plugin-image): Update types (#29226)
Browse files Browse the repository at this point in the history
  • Loading branch information
ascorbic committed Jan 27, 2021
1 parent bca9518 commit 7a589c0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ export interface GatsbyImageProps

export interface IGatsbyImageData {
layout: Layout
height?: number
width: number
height: number
backgroundColor?: string
images: Pick<MainImageProps, "sources" | "fallback">
placeholder?: Pick<PlaceholderProps, "sources" | "fallback">
width?: number
}

let hasShownWarning = false
Expand Down
4 changes: 2 additions & 2 deletions packages/gatsby-plugin-image/src/image-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ export function generateImageData(
}
})

const imageProps: IGatsbyImageData = { images: result, layout }
const imageProps: Partial<IGatsbyImageData> = { images: result, layout }
switch (layout) {
case `fixed`:
imageProps.width = imageSizes.presentationWidth
Expand All @@ -279,7 +279,7 @@ export function generateImageData(
imageProps.height = (imageProps.width || 1) / imageSizes.aspectRatio
}

return imageProps
return imageProps as IGatsbyImageData
}

const dedupeAndSortDensities = (values: Array<number>): Array<number> =>
Expand Down

0 comments on commit 7a589c0

Please sign in to comment.