aboutsummaryrefslogtreecommitdiffstats
path: root/src/ts/types/app.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/ts/types/app.ts')
-rw-r--r--src/ts/types/app.ts75
1 files changed, 75 insertions, 0 deletions
diff --git a/src/ts/types/app.ts b/src/ts/types/app.ts
index 488fe6e..ba28416 100644
--- a/src/ts/types/app.ts
+++ b/src/ts/types/app.ts
@@ -1,6 +1,22 @@
import { NextPage } from 'next';
import { AppProps } from 'next/app';
import { ReactElement, ReactNode } from 'react';
+import { PostBy } from './articles';
+import { AllPostsSlug, RawPostsList } from './blog';
+import { CommentData, CreateComment } from './comments';
+import { ContactData, SendEmail } from './contact';
+import { HomePageBy } from './homepage';
+import { PageBy } from './pages';
+import {
+ AllSubjectsSlug,
+ AllThematicsSlug,
+ SubjectBy,
+ ThematicBy,
+} from './taxonomies';
+
+//==============================================================================
+// Next
+//==============================================================================
export type NextPageWithLayout<P = {}> = NextPage<P> & {
getLayout?: (page: ReactElement) => ReactNode;
@@ -9,3 +25,62 @@ export type NextPageWithLayout<P = {}> = NextPage<P> & {
export type AppPropsWithLayout = AppProps & {
Component: NextPageWithLayout;
};
+
+//==============================================================================
+// API
+//==============================================================================
+
+export type VariablesType<T> = T extends
+ | PageBy
+ | PostBy
+ | SubjectBy
+ | ThematicBy
+ ? Slug
+ : T extends RawPostsList
+ ? CursorPagination
+ : T extends CreateComment
+ ? CommentData
+ : T extends SendEmail
+ ? ContactData
+ : null;
+
+export type RequestType =
+ | AllPostsSlug
+ | AllSubjectsSlug
+ | AllThematicsSlug
+ | CreateComment
+ | HomePageBy
+ | PageBy
+ | PostBy
+ | SubjectBy
+ | ThematicBy
+ | RawPostsList
+ | SendEmail;
+
+//==============================================================================
+// Globals
+//==============================================================================
+
+export type ContentParts = {
+ afterMore: string;
+ beforeMore: string;
+};
+
+export type CursorPagination = {
+ first: number;
+ after: string;
+};
+
+export type Dates = {
+ publication: string;
+ update: string;
+};
+
+export type PageInfo = {
+ endCursor: string;
+ hasNextPage: boolean;
+};
+
+export type Slug = {
+ slug: string;
+};