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-plugin-image): Correct type for getImage #36169

Merged
merged 2 commits into from Jul 19, 2022
Merged

Conversation

LekoArts
Copy link
Contributor

@LekoArts LekoArts commented Jul 19, 2022

Description

Uses <Partial> so that not full Node is necessary. Otherwise people would need to type their results fully. Also allow null because our graphqlTypegen feature creates gatsbyImageData: import('gatsby-plugin-image').IGatsbyImageData } | null

Related Issues

Fixes #35748

[ch53435]

@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Jul 19, 2022
@LekoArts LekoArts added topic: media Related to gatsby-plugin-image, or general image/media processing topics and removed status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer labels Jul 19, 2022
@LekoArts LekoArts added the bot: merge on green Gatsbot will merge these PRs automatically when all tests passes label Jul 19, 2022
Comment on lines -30 to +31
export type FileNode = Node & {
childImageSharp?: IGatsbyImageDataParent<Node>
export type FileNode = Partial<Node> & {
childImageSharp?: IGatsbyImageDataParent<Partial<Node>>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It feels like we don't care about this looking like a "Node" properties at all and just care about childImageSharp? maybe we drop Node completely and have just have object type with childImageSharp optional field?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a blocker tho, so will approve

@gatsbybot gatsbybot merged commit b3f434b into master Jul 19, 2022
@gatsbybot gatsbybot deleted the fix-35748 branch July 19, 2022 11:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bot: merge on green Gatsbot will merge these PRs automatically when all tests passes topic: media Related to gatsby-plugin-image, or general image/media processing topics
Projects
None yet
Development

Successfully merging this pull request may close these issues.

getImage types requires Node properties in it
4 participants