refactor: make all Props defined as interface + readonly (#5636)

* Initial work

* Fix
This commit is contained in:
Joshua Chen 2021-10-06 01:04:24 +08:00 committed by GitHub
parent 21ef908f00
commit 7f7b858cd4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 169 additions and 141 deletions

View file

@ -16,9 +16,9 @@ declare module '@theme/BlogSidebar' {
items: BlogSidebarItem[];
};
export type Props = {
export interface Props {
readonly sidebar: BlogSidebar;
};
}
const BlogSidebar: (props: Props) => JSX.Element;
export default BlogSidebar;
@ -57,10 +57,10 @@ declare module '@theme/BlogPostPage' {
(): JSX.Element;
};
export type Props = {
export interface Props {
readonly sidebar: BlogSidebar;
readonly content: Content;
};
}
const BlogPostPage: (props: Props) => JSX.Element;
export default BlogPostPage;
@ -82,11 +82,11 @@ declare module '@theme/BlogListPage' {
readonly totalPages: number;
};
export type Props = {
export interface Props {
readonly sidebar: BlogSidebar;
readonly metadata: Metadata;
readonly items: readonly {readonly content: Content}[];
};
}
const BlogListPage: (props: Props) => JSX.Element;
export default BlogListPage;
@ -103,10 +103,10 @@ declare module '@theme/BlogTagsListPage' {
slug: string;
};
export type Props = {
export interface Props {
readonly sidebar: BlogSidebar;
readonly tags: Readonly<Record<string, Tag>>;
};
}
const BlogTagsListPage: (props: Props) => JSX.Element;
export default BlogTagsListPage;
@ -117,11 +117,11 @@ declare module '@theme/BlogTagsPostsPage' {
import type {Tag} from '@theme/BlogTagsListPage';
import type {Content} from '@theme/BlogPostPage';
export type Props = {
export interface Props {
readonly sidebar: BlogSidebar;
readonly metadata: Tag;
readonly items: readonly {readonly content: Content}[];
};
}
const BlogTagsPostsPage: (props: Props) => JSX.Element;
export default BlogTagsPostsPage;
@ -132,11 +132,11 @@ declare module '@theme/BlogArchivePage' {
export type ArchiveBlogPost = Content;
export type Props = {
export interface Props {
readonly archive: {
blogPosts: readonly ArchiveBlogPost[];
readonly blogPosts: readonly ArchiveBlogPost[];
};
};
}
export default function BlogArchivePage(props: Props): JSX.Element;
}