Skip to content

Instantly share code, notes, and snippets.

@beerose
Created August 25, 2019 07:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save beerose/0d00d17212095b82f22085ad8c647d31 to your computer and use it in GitHub Desktop.
Save beerose/0d00d17212095b82f22085ad8c647d31 to your computer and use it in GitHub Desktop.
export type ApiError = {
error: string;
error_details?: string;
};
export interface TypedResponse<T = ApiError> extends Response {
status: (status: number) => TypedResponse<T | ApiError>;
send: (body: T | ApiError) => TypedResponse<T | ApiError>;
}
export const list = (
req: Request,
res: TypedResponse<ItemDTO[]>
) => {
// implementation
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment