From a882d182a718bb1b1cd9c15083dc2a38e72b8f6f Mon Sep 17 00:00:00 2001 From: toridoriv Date: Tue, 3 Oct 2023 19:22:30 -0300 Subject: [PATCH] :label: (api): Add ApiResponse type globally --- server/@global.ts | 9 ++++----- server/api/@endpoint.ts | 2 ++ 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/server/@global.ts b/server/@global.ts index 17ee425..3955f55 100644 --- a/server/@global.ts +++ b/server/@global.ts @@ -1,11 +1,8 @@ -import type { express, Fanfictions, Logger } from "@deps"; +import type { express, Logger } from "@deps"; import { databaseClient } from "./database.ts"; -import { GenericApiResponse } from "./api/@endpoint.ts"; +import { AnyApiResponse } from "./api/@endpoint.ts"; declare global { - function fetch(input: "./api/fanfictions"): Promise<{ - json: () => Promise>; - }>; /** * Instead of adding a `disable` directive, use this value * to indicate that an any type is expected that way purposely. @@ -13,6 +10,8 @@ declare global { // deno-lint-ignore no-explicit-any type SafeAny = any; + export type ApiResponseType = AnyApiResponse; + namespace Express { interface Application { db: typeof databaseClient; diff --git a/server/api/@endpoint.ts b/server/api/@endpoint.ts index 771453c..56a4a48 100644 --- a/server/api/@endpoint.ts +++ b/server/api/@endpoint.ts @@ -226,6 +226,8 @@ export type AnyPayload = z.ZodObject< */ export type AnyEndpoint = ApiEndpoint; +export type AnyApiResponse = ApiResponse; + // #endregion /* -------------------------------------------------------------------------- */