问题描述
我有一个使用 Gatsby(带有 gatsby-plugin-image
)的站点,我正在尝试重构为 Typescript。这是我第一次接触ts
我有一个使用 pagequery 提取 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;
};
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)