gatsby-source-sanity icon indicating copy to clipboard operation
gatsby-source-sanity copied to clipboard

'maxWidth' does not exist on type GatsbyImageDataArgs

Open codingwithchris opened this issue 3 years ago • 5 comments

In the documentation for using the new gatsby-plugin-image with gatsby-source-sanity, the example shows an implementation of getGatsbyImageData and passes in an object with a maxWidth set.

Example here: https://www.gatsbyjs.com/plugins/gatsby-source-sanity/#using-images

In reality, the GatsbyImageDataArgs type does not have a maxWidth property available:

export declare type GatsbyImageDataArgs = {
    width?: number;
    height?: number;
    aspectRatio?: number;
    layout?: Layout;
    sizes?: string;
    placeholder?: 'blurred' | 'dominantColor' | 'none';
    fit?: ImageFit;
};

So it seems the documentation is incorrect.

The real bummer is that it appears maxWidth queries are no longer supported like they used to be. Previously, you could do a fluid query with a maxWidth set in Graphql to limit the size of the retrieved image. Now a hard set width is required.

Does this width function in the same way that maxWidth used to?

codingwithchris avatar Apr 10 '21 16:04 codingwithchris

Same issue here.

alainkaiser avatar Apr 23 '21 10:04 alainkaiser

Same issue here :/

mikeytown19 avatar Aug 15 '21 02:08 mikeytown19

Same issue here...

KJHeartbreaker avatar Oct 07 '21 06:10 KJHeartbreaker

Same issue here...

joetm avatar Jun 06 '22 10:06 joetm

@evenwestvang Is anyone at Sanity aware of this issue? This has been open for over a year and is a quite fundamental problem.

Hahlh avatar Jun 06 '22 11:06 Hahlh