15 lines
344 B
TypeScript
15 lines
344 B
TypeScript
type SuccessResponse<Body> = {
|
|
success: true;
|
|
body: Body;
|
|
};
|
|
|
|
export type ErrorMessage = string;
|
|
|
|
export const isErrorMessage = (error: unknown): error is ErrorMessage => typeof error === 'string';
|
|
|
|
type ErrorResponse = {
|
|
success: false;
|
|
message: ErrorMessage;
|
|
};
|
|
|
|
export type BaseResponse<Body> = SuccessResponse<Body> | ErrorResponse; |