From 28072a7dfdaa20e8b55036e7d552cd4b5b057ec6 Mon Sep 17 00:00:00 2001 From: zkldi Date: Wed, 26 May 2021 21:01:05 +0100 Subject: [PATCH] Generify APIResponse --- common/js/types.d.ts | 4 ++-- common/src/types.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/common/js/types.d.ts b/common/js/types.d.ts index a56afe1a9..ad63f2766 100644 --- a/common/js/types.d.ts +++ b/common/js/types.d.ts @@ -87,10 +87,10 @@ export interface UnsuccessfulAPIResponse { * In the event of a successful API request, body is attached onto the request, which contains * endpoint-defined information about the response, such as database data. */ -export interface SuccessfulAPIResponse { +export interface SuccessfulAPIResponse { success: true; description: string; - body: unknown; + body: T; } export interface ChartFolderLookupDocument extends MongoDBDocument { chartID: string; diff --git a/common/src/types.ts b/common/src/types.ts index 6c27f058d..9b3a5d462 100644 --- a/common/src/types.ts +++ b/common/src/types.ts @@ -146,7 +146,7 @@ export interface UnsuccessfulAPIResponse { * In the event of a successful API request, body is attached onto the request, which contains * endpoint-defined information about the response, such as database data. */ -export interface SuccessfulAPIResponse { +export interface SuccessfulAPIResponse { success: true; description: string; // This isn't ideal, but we need to restrict @@ -154,7 +154,7 @@ export interface SuccessfulAPIResponse { // mandates indexability of the type, which makes // it unusable for known objects. // eslint-disable-next-line @typescript-eslint/ban-types - body: unknown; + body: T; } export interface ChartFolderLookupDocument extends MongoDBDocument {