init
This commit is contained in:
26
@types/index.d.ts
vendored
Normal file
26
@types/index.d.ts
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
|
||||
/**
|
||||
* 错误响应
|
||||
*/
|
||||
interface ExpressResponseError extends Record<string,unknown>{
|
||||
error:string
|
||||
}
|
||||
|
||||
/**
|
||||
* 响应列表
|
||||
*/
|
||||
interface ExpressResponseList<T=Record<string,unknown>> extends Record<string,unknown>{
|
||||
list:T[]
|
||||
}
|
||||
|
||||
interface ExpressResponseDetail<T=Record<string,unknown>> extends Record<string,unknown>{
|
||||
detail:T
|
||||
}
|
||||
|
||||
declare namespace Express {
|
||||
export interface Response {
|
||||
error(error:string,statusCode:number,errObj:Record<string,unknown>):ExpressResponseError
|
||||
list<T=Record<string,unknown>>(list:T,resObj:Record<string,unknown>):ExpressResponseList<T>
|
||||
detail<T=Record<string,unknown>>(detail:T,resObj:Record<string,unknown>):ExpressResponseDetail<T>
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user