export interface UserFailureResponse {
statusCode: number
statusMessage: string
}
export interface UserCreateResponse {
statusCode: number
statusMessage: string
}
export interface AuthCheckResponse {
statusCode: number
statusMessage: string
}
Here I have created three different Response interfaces that are the same.
I am planning to create a generic interface like 'Response'. But is this the right convention with scalability and adaptability in mind? Would like to hear from the TS community as I am new to this
CodePudding user response:
use extends
export interface BaseResponse {
statusCode: number
statusMessage: string
}
export interface UserFailureResponse extends BaseResponse { }
export interface UserCreateResponse extends BaseResponse{ }
export interface AuthCheckResponse extends BaseResponse{ }