Skip to content

Commit 08e0aa1

Browse files
schwartzmjascorbic
andauthored
fix(gatsby-image): Fix typings for fixed and fluid props (#24767)
Co-authored-by: Matt Kane <m@mk.gg>
1 parent e6b6268 commit 08e0aa1

2 files changed

Lines changed: 18 additions & 4 deletions

File tree

packages/gatsby-image/index.d.ts

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,15 @@ export interface FluidObject {
2424
media?: string
2525
}
2626

27-
interface GatsbyImageProps {
27+
interface GatsbyImageOptionalProps {
28+
/**
29+
* @deprecated Use `fixed`
30+
*/
2831
resolutions?: FixedObject
32+
/**
33+
* @deprecated Use `fluid`
34+
*/
2935
sizes?: FluidObject
30-
fixed?: FixedObject | FixedObject[]
31-
fluid?: FluidObject | FluidObject[]
3236
fadeIn?: boolean
3337
durationFadeIn?: number
3438
title?: string
@@ -49,6 +53,16 @@ interface GatsbyImageProps {
4953
loading?: `auto` | `lazy` | `eager`
5054
draggable?: boolean
5155
}
56+
57+
interface GatsbyImageFluidProps extends GatsbyImageOptionalProps {
58+
fluid: FluidObject | FluidObject[]
59+
}
60+
61+
interface GatsbyImageFixedProps extends GatsbyImageOptionalProps {
62+
fixed: FixedObject | FixedObject[]
63+
}
64+
65+
export type GatsbyImageProps = GatsbyImageFluidProps | GatsbyImageFixedProps
5266

5367
export default class GatsbyImage extends React.Component<
5468
GatsbyImageProps,

packages/gatsby-image/withIEPolyfill/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import * as React from "react"
22

33
import GatsbyImage, { GatsbyImageProps } from "../index"
44

5-
interface GatsbyImageWithIEPolyfillProps extends GatsbyImageProps {
5+
type GatsbyImageWithIEPolyfillProps = GatsbyImageProps & {
66
objectFit?: `fill` | `contain` | `cover` | `none` | `scale-down`
77
objectPosition?: string
88
}

0 commit comments

Comments
 (0)