MISC: Add generic type as returned type for action and checking (#1748)

This commit is contained in:
catloversg 2024-11-07 09:10:56 +07:00 committed by GitHub
parent 36eb12098f
commit 60c4be0496
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -31,6 +31,10 @@ export interface IReturnStatus {
msg?: string; msg?: string;
} }
type SuccessResult<T extends object> = { success: true; message?: string } & T;
type FailureResult = { success: false; message: string };
export type Result<T extends object = object> = SuccessResult<T> | FailureResult;
/** Defines the minimum and maximum values for a range. /** 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 consumer if these values are inclusive or exclusive.
* It is up to the implementor to ensure max > min. */ * It is up to the implementor to ensure max > min. */