5

我有一个使用 Gatsby (with gatsby-plugin-image) 的站点,我正在尝试重构为 Typescript。这是我第一次接触ts

我有一个布局页面,它使用一个页面查询来提取 Mdx 数据,但是我错过了一些类型,并且想知道是否有人能指出我正确的方向。

我正在努力寻找应该导入和使用的类型:

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

在处理图像的旧gatsby-image方法上,它使用了类型,FixedObject但这不再有效。

任何人都可以为这些缺失的类型指出正确的方向吗?

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;
};
4

0 回答 0