docusaurus/packages/docusaurus-plugin-content-blog/index.d.ts
Joshua Chen ee6ebc4877
refactor: better typing + remove unnecessary eslint-disable (#5335)
* Initial work

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Fix a few errors

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Restore default value

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Update docs

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Use custom route config

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Address a few suggestions

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Revert logo change

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Restore key

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Oops

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Remove use of any

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Remove eslint-disable

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Put type reference back

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Remove

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>
2021-08-11 16:07:17 +02:00

146 lines
3.9 KiB
TypeScript

/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
declare module '@theme/BlogSidebar' {
export type BlogSidebarItem = {title: string; permalink: string};
export type BlogSidebar = {
title: string;
items: BlogSidebarItem[];
};
export type Props = {
readonly sidebar: BlogSidebar;
};
const BlogSidebar: (props: Props) => JSX.Element;
export default BlogSidebar;
}
declare module '@theme/BlogPostPage' {
import type {TOCItem} from '@docusaurus/types';
import type {BlogSidebar} from '@theme/BlogSidebar';
export type FrontMatter = {
/* eslint-disable camelcase */
readonly title: string;
readonly author?: string;
readonly image?: string;
readonly tags?: readonly string[];
readonly keywords?: readonly string[];
readonly author_url?: string;
readonly authorURL?: string;
readonly author_title?: string;
readonly authorTitle?: string;
readonly author_image_url?: string;
readonly authorImageURL?: string;
readonly hide_table_of_contents?: boolean;
/* eslint-enable camelcase */
};
export type FrontMatterAssets = {
/* eslint-disable camelcase */
readonly image?: string;
readonly author_image_url?: string;
readonly authorImageURL?: string;
/* eslint-enable camelcase */
};
export type Metadata = {
readonly title: string;
readonly date: string;
readonly formattedDate: string;
readonly permalink: string;
readonly description?: string;
readonly editUrl?: string;
readonly readingTime?: number;
readonly truncated?: string;
readonly nextItem?: {readonly title: string; readonly permalink: string};
readonly prevItem?: {readonly title: string; readonly permalink: string};
readonly tags: readonly {
readonly label: string;
readonly permalink: string;
}[];
};
export type Content = {
readonly frontMatter: FrontMatter;
readonly frontMatterAssets: FrontMatterAssets;
readonly metadata: Metadata;
readonly toc: readonly TOCItem[];
(): JSX.Element;
};
export type Props = {
readonly sidebar: BlogSidebar;
readonly content: Content;
};
const BlogPostPage: (props: Props) => JSX.Element;
export default BlogPostPage;
}
declare module '@theme/BlogListPage' {
import type {Content} from '@theme/BlogPostPage';
import type {BlogSidebar} from '@theme/BlogSidebar';
export type Item = {
readonly content: () => JSX.Element;
};
export type Metadata = {
readonly blogTitle: string;
readonly blogDescription: string;
readonly nextPage?: string;
readonly page: number;
readonly permalink: string;
readonly postsPerPage: number;
readonly previousPage?: string;
readonly totalCount: number;
readonly totalPages: number;
};
export type Props = {
readonly sidebar: BlogSidebar;
readonly metadata: Metadata;
readonly items: readonly {readonly content: Content}[];
};
const BlogListPage: (props: Props) => JSX.Element;
export default BlogListPage;
}
declare module '@theme/BlogTagsListPage' {
import type {BlogSidebar} from '@theme/BlogSidebar';
export type Tag = {
permalink: string;
name: string;
count: number;
allTagsPath: string;
slug: string;
};
export type Props = {
readonly sidebar: BlogSidebar;
readonly tags: Readonly<Record<string, Tag>>;
};
const BlogTagsListPage: (props: Props) => JSX.Element;
export default BlogTagsListPage;
}
declare module '@theme/BlogTagsPostsPage' {
import type {BlogSidebar} from '@theme/BlogSidebar';
import type {Tag} from '@theme/BlogTagsListPage';
import type {Content} from '@theme/BlogPostPage';
export type Props = {
readonly sidebar: BlogSidebar;
readonly metadata: Tag;
readonly items: readonly {readonly content: Content}[];
};
}