imgix/gatsby

Type Definition for "TRACED_SVG" Missing

ErikAGriffin opened this issue · 1 comments

Describe the bug

When using gatsby-plugin-image with Typescript, using placeholder: TRACED_SVG in the GraphQL query results in a type error.
Digging into this further, it appears that this file, graphqlTypes.ts is missing the attribute TRACED_SVG.

The full types can be found here: in gatsby-transformer-sharp. For some reason TRACED_SVG has been left out of the types definition for @imgix/gatsby. Is there a reason TRACED_SVG has been left out? It's a valid placeholder option, yet the current @imgix/gatsby library prevents its use.

To Reproduce
In a gatsby project configured with Typescript, create a GraphQL query which requests a TRACED_SVG placeholder.

  const data: MyGraphqlQuery = useStaticQuery(graphql`
    query MyGraphql {
      prismicFrontPage {
        data {
          image_resource_name {
            gatsbyImageData(placeholder: TRACED_SVG, layout: FULL_WIDTH)
          }
        }
      }
    }
  `);

Expected behaviour
This is a valid placeholder option, it is expected to have a type defined in this file, graphqlTypes.ts

Screenshots
image

Information:

  • imgix/gatsby version: "@imgix/gatsby@^1.6.9":
  • gatsby version: "gatsby": "^3.6.2",
  • gatsby-plugin-image version: "gatsby-plugin-image": "^1.6.0",

Hi @ErikAGriffin, Fred from imgix here 👋 Thanks for opening this issue.

Although it's true that TRACED_SVG is supported in gatsby-transformer-sharp, at this stage we have no way to reproduce this functionality with imgix as we do not use gatsby-transformer-sharp. If you are able to reproduce this behaviour with imgix, please let us know and we will see if we can integrate it into this library.

In either case, using a colour placeholder is now the recommended approach by the Gatsby team.

I'll close this now as I think this is resolved, but please feel free to comment if you have anything more to discuss.