8

I have a site using Gatsby (with gatsby-plugin-image) and I am trying to refactor to Typescript. This is my first experience with ts

I have a layout page that uses a pagequery that pulls Mdx data, however I am missing some types though and wondered if anyone could point me in the right direction.

I am struggling to find what type I should import and use for:

childImageSharp: {fixed:???}
MdxQuery = {body: ???}`

On the old gatsby-image means of handling images it used the type of FixedObject but this no longer works.

Can anyone point me in the right direction please for these missing types?

type Frontmatter = {
  title: string;
  titlestrap: string | null;
  category: string;
  slug: string;
  metaDescription: string | null;
  author?: string | null;
  featuredImage: {
    childImageSharp: {
      fixed: any; // what here?
      gatsbyImageData: IGatsbyImageData;
    };
  };
};

type MdxQuery = {
  id: string;
  body: any; // what here?
  frontmatter: Frontmatter;
  excerpt: string;
};
Nick Wild
  • 525
  • 1
  • 11
  • 22

0 Answers0