Skip to content

Commit

Permalink
chore(gatsby-image): Add missing type definitions for GatsbyImageProps (
Browse files Browse the repository at this point in the history
gatsbyjs#18916)

* Add missing properties to GatsbyImageProps typedef

Added missing properties from Gatsby Image prop types (https://github.com/gatsbyjs/gatsby/blob/3776d39e15368fdd1468d4424c93c8b4ffa3415e/packages/gatsby-image/src/index.js#L660-L685) to TypeScript type definitions of Gatsby Image.

* Add sync comment to GatsbyImage propTypes

* Add sync comment to GatsbyImageWithIEPolyfill propTypes

* Replace paths by GitHub URLs in GatsbyImageWithIEPolyfill comment

* Replace paths by GitHub URLs in GatsbyImage comment
  • Loading branch information
dcastil authored and rickiesmooth committed Nov 8, 2019
1 parent 2c096ee commit 925f4bd
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/gatsby-image/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ interface GatsbyImageProps {
fixed?: FixedObject | FixedObject[]
fluid?: FluidObject | FluidObject[]
fadeIn?: boolean
durationFadeIn?: number
title?: string
alt?: string
className?: string | object
Expand All @@ -38,11 +39,12 @@ interface GatsbyImageProps {
style?: object
imgStyle?: object
placeholderStyle?: object
placeholderClassName?: string
backgroundColor?: string | boolean
onLoad?: () => void
onStartLoad?: (param: { wasCached: boolean }) => void
onError?: (event: any) => void
onClick?: () => void
onStartLoad?: (param: { wasCached: boolean }) => void
Tag?: string
itemProp?: string
loading?: `auto` | `lazy` | `eager`
Expand Down
4 changes: 4 additions & 0 deletions packages/gatsby-image/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -657,6 +657,10 @@ const fluidObject = PropTypes.shape({
media: PropTypes.string,
})

// If you modify these propTypes, please don't forget to update following files as well:
// https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby-image/index.d.ts
// https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby-image/README.md#gatsby-image-props
// https://github.com/gatsbyjs/gatsby/blob/master/docs/docs/gatsby-image.md#gatsby-image-props
Image.propTypes = {
resolutions: fixedObject,
sizes: fluidObject,
Expand Down
4 changes: 4 additions & 0 deletions packages/gatsby-image/src/withIEPolyfill/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ class ImageWithIEPolyfill extends Component {
}
}

// If you modify these propTypes, please don't forget to update following files as well:
// https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby-image/withIEPolyfill/index.d.ts
// https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby-image/README.md#gatsby-image-props
// https://github.com/gatsbyjs/gatsby/blob/master/docs/docs/gatsby-image.md#gatsby-image-props
ImageWithIEPolyfill.propTypes = {
objectFit: PropTypes.string,
objectPosition: PropTypes.string,
Expand Down

0 comments on commit 925f4bd

Please sign in to comment.