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): Fix StaticImage props interface and add propTypes #28372

Merged
merged 2 commits into from
Dec 1, 2020

Conversation

ascorbic
Copy link
Contributor

This fixes the interface for StaticImage props, and adds propTypes validation. Previously doing something like passing a string for "width" would lead to the image not resolving, rather than giving a helpful error. This now also enforces proptypes based on the layout, e.g. requiring width and forbidding maxWidth in fixed layout images. It also stops passing through all props to the DOM element, as that was causing react errors

@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Nov 30, 2020
@@ -1,7 +1,9 @@
/* global SERVER */
// eslint-disable-next-line @typescript-eslint/triple-slash-reference
/// <reference path="../global.d.ts" />
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't know why this has regressed, but this seems to be the onyl way I can get it to include the globals in the compilation

Copy link
Contributor

@laurieontech laurieontech left a comment

Choose a reason for hiding this comment

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

Looks good! Really like the checkDimensions warnings.

@ascorbic ascorbic merged commit 93a1447 into master Dec 1, 2020
pieh pushed a commit that referenced this pull request Dec 1, 2020
…pTypes (#28372)

* Add proptypes and better props defs

* Fix compilation error

(cherry picked from commit 93a1447)
pieh pushed a commit that referenced this pull request Dec 1, 2020
…pTypes (#28372) (#28402)

* Add proptypes and better props defs

* Fix compilation error

(cherry picked from commit 93a1447)

Co-authored-by: Matt Kane <[email protected]>
@LekoArts LekoArts removed the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Dec 14, 2020
@LekoArts LekoArts deleted the fix/static-image-props branch April 23, 2021 11:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants