如何解决使用 GatsbyImageData 和 Mdx 在 Gatsby 中丢失类型
我有一个使用 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 举报,一经查实,本站将立刻删除。