Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(gatsby-image): Fix typings for fixed and fluid props #24767

Merged
merged 6 commits into from
Aug 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions packages/gatsby-image/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,15 @@ export interface FluidObject {
media?: string
}

interface GatsbyImageProps {
interface GatsbyImageOptionalProps {
/**
* @deprecated Use `fixed`
*/
resolutions?: FixedObject
/**
* @deprecated Use `fluid`
*/
sizes?: FluidObject
fixed?: FixedObject | FixedObject[]
fluid?: FluidObject | FluidObject[]
fadeIn?: boolean
durationFadeIn?: number
title?: string
Expand All @@ -49,6 +53,16 @@ interface GatsbyImageProps {
loading?: `auto` | `lazy` | `eager`
draggable?: boolean
}

interface GatsbyImageFluidProps extends GatsbyImageOptionalProps {
fluid: FluidObject | FluidObject[]
}

interface GatsbyImageFixedProps extends GatsbyImageOptionalProps {
fixed: FixedObject | FixedObject[]
}

export type GatsbyImageProps = GatsbyImageFluidProps | GatsbyImageFixedProps

export default class GatsbyImage extends React.Component<
GatsbyImageProps,
Expand Down
2 changes: 1 addition & 1 deletion packages/gatsby-image/withIEPolyfill/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as React from "react"

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

interface GatsbyImageWithIEPolyfillProps extends GatsbyImageProps {
type GatsbyImageWithIEPolyfillProps = GatsbyImageProps & {
objectFit?: `fill` | `contain` | `cover` | `none` | `scale-down`
objectPosition?: string
}
Expand Down