refactor: move exported type definitions to declaration file (#6300)

* refactor: move exported type definitions to declaration file

* fix

* fix
This commit is contained in:
Joshua Chen 2022-01-09 22:02:31 +08:00 committed by GitHub
parent 9c0e659a44
commit cf265c051e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
53 changed files with 482 additions and 452 deletions

View file

@ -12,21 +12,7 @@ import {
FrontMatterTagsSchema,
FrontMatterTOCHeadingLevels,
} from '@docusaurus/utils-validation';
import type {FrontMatterTag} from '@docusaurus/utils';
export type BlogPostFrontMatterAuthor = Record<string, unknown> & {
key?: string;
name?: string;
imageURL?: string;
url?: string;
title?: string;
};
// All the possible variants that the user can use for convenience
export type BlogPostFrontMatterAuthors =
| string
| BlogPostFrontMatterAuthor
| (string | BlogPostFrontMatterAuthor)[];
import type {BlogPostFrontMatter} from '@docusaurus/plugin-content-blog';
const BlogPostFrontMatterAuthorSchema = Joi.object({
key: Joi.string(),
@ -38,37 +24,6 @@ const BlogPostFrontMatterAuthorSchema = Joi.object({
.or('key', 'name')
.rename('image_url', 'imageURL', {alias: true});
export type BlogPostFrontMatter = {
id?: string;
title?: string;
description?: string;
tags?: FrontMatterTag[];
slug?: string;
draft?: boolean;
date?: Date | string; // Yaml automagically convert some string patterns as Date, but not all
authors?: BlogPostFrontMatterAuthors;
// We may want to deprecate those older author frontmatter fields later:
author?: string;
author_title?: string;
author_url?: string;
author_image_url?: string;
/** @deprecated */
authorTitle?: string;
/** @deprecated */
authorURL?: string;
/** @deprecated */
authorImageURL?: string;
image?: string;
keywords?: string[];
hide_table_of_contents?: boolean;
toc_min_heading_level?: number;
toc_max_heading_level?: number;
};
const FrontMatterAuthorErrorMessage =
'{{#label}} does not look like a valid blog post author. Please use an author key or an author object (with a key and/or name).';