Nic*_*ild 9 typescript gatsby mdxjs gatsby-image
我有一个使用 Gatsby (带有gatsby-plugin-image
)的网站,我正在尝试重构为 Typescript。这是我第一次接触 ts
我有一个布局页面,它使用页面查询来提取 Mdx 数据,但是我缺少一些类型,并且想知道是否有人可以为我指出正确的方向。
我正在努力寻找应该导入和使用的类型:
childImageSharp: {fixed:???}
MdxQuery = {body: ???}`
Run Code Online (Sandbox Code Playgroud)
在处理图像的旧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;
};
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
756 次 |
最近记录: |