From 60c4be04962684b282380d22b0861c302014c3b2 Mon Sep 17 00:00:00 2001 From: catloversg <152669316+catloversg@users.noreply.github.com> Date: Thu, 7 Nov 2024 09:10:56 +0700 Subject: [PATCH] MISC: Add generic type as returned type for action and checking (#1748) --- src/types.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/types.ts b/src/types.ts index 384bbdd8d..1d77ca71f 100644 --- a/src/types.ts +++ b/src/types.ts @@ -31,6 +31,10 @@ export interface IReturnStatus { msg?: string; } +type SuccessResult = { success: true; message?: string } & T; +type FailureResult = { success: false; message: string }; +export type Result = SuccessResult | FailureResult; + /** Defines the minimum and maximum values for a range. * It is up to the consumer if these values are inclusive or exclusive. * It is up to the implementor to ensure max > min. */