-
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
[gatsby-image] Bad schema typing for gatsby-images ? #17003
Comments
I experience the same problem with TypeScript generation. Instead of weaken the types of gatsby-image, this should be addressed in the schema. As a result we can distinguish between fluid and fixed object and get a type error when used wrong. |
Yeah, not really for weakening the types either :) I'd rather have gatsby image being a graphql union type and being more precise on the schema typings, like |
Hiya! This issue has gone quiet. Spooky quiet. 👻 We get a lot of issues, so we currently close issues after 30 days of inactivity. It’s been at least 20 days since the last update here. If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not stale" to keep this issue open! As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing! Thanks for being a part of the Gatsby community! 💪💜 |
Not stale |
Hey again! It’s been 30 days since anything happened on this issue, so our friendly neighborhood robot (that’s me!) is going to close it. Please keep in mind that I’m only a robot, so if I’ve closed this issue in error, I’m As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing! Thanks again for being part of the Gatsby community! |
Can we re-open? Not stale. |
Hey again! It’s been 30 days since anything happened on this issue, so our friendly neighborhood robot (that’s me!) is going to close it. Please keep in mind that I’m only a robot, so if I’ve closed this issue in error, I’m As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing! Thanks again for being part of the Gatsby community! |
Stumbled upon the same problem today. I think this should be reconsidered.. |
Hiya! This issue has gone quiet. Spooky quiet. 👻 We get a lot of issues, so we currently close issues after 30 days of inactivity. It’s been at least 20 days since the last update here. Thanks for being a part of the Gatsby community! 💪💜 |
Not so spooky anymore 👻 Please review my pull request which should resolve the problem for Contentful and ImageSharp |
Hi,
The TS defs for a fluid image is:
Yet if we look at a graphql image fragment like this one, we can notice they are actually incompatible:
The GraphQL schema says that all those attributes can be undefined (which does not really make sense to me, is it possible to have an image without at least an src?)
The problem is that if you try to generate typedefs from generic queries, you'll end up with incompatible typings and will have to find workarounds (like using "any").
Otherwise you'll get typescript errors like this:
I suggest to make those types compatible so that people using tools like graphql-codegen can easily use gatsby images
The text was updated successfully, but these errors were encountered: