-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
Conversation
GatsbyImage should require one of "fluid" or "fixed". Currently they are both optional.
fix typo extends GatsbyImage -> GatsbyImageOptionalProps
I believe this is important because if an Once the site is live, the page crashes to a white screen with error This isn't something that can always be caught in development because a template may pull in images and generate pages dynamically. |
This is great. It is technically a breaking change though, because people could be using the old deprecated props /**
* @deprecated Use `fixed`
*/
resolutions?: FixedObject |
Co-authored-by: Matt Kane <[email protected]>
Sounds good, I've made those adjustments. If you have any other suggestions let me know! |
@schwartzmj Could you check the types in the IE polyfill. It's currently failing typechecks |
Good catch. I've made some changes to account for that. It looks like the "Gatsby Build Service" is failing. Anything on my end I need to fix? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is good to go. Thanks @schwartzmj!
As @henrikra mentioned: Until gatsby-image 2.4.15, I was doing this, using styled-components: const Photo = styled(Image)`
/* some css */
` And then
But since gatsby-image 2.4.16 (this PR), I'm getting this TypeScript error:
|
When using the
https://www.typescriptlang.org/docs/handbook/unions-and-intersections.html#unions-with-common-fields |
I think the issue goes back to styled-components: styled-components/styled-components#3385 |
Good finding @aquelehugo . Please guys show your support at styled-components/styled-components#3385 so we get this annoying bug resolved! |
There is now PR which fixes this problem! DefinitelyTyped/DefinitelyTyped#51252 |
) Co-authored-by: Matt Kane <[email protected]>
Description
GatsbyImage should require one of "fluid" or "fixed". Currently they are both optional.
Documentation
Self documenting types. Not changing file exports.
Related Issues