declare interface MockMethod { url: string; method?: MethodType; timeout?: number; statusCode?: number; response?: ((this: RespThisType, opt: { url: Recordable; body: Recordable; query: Recordable; headers: Recordable; }) => any); rawResponse?: (this: RespThisType, req: IncomingMessage, res: ServerResponse) => void; } response的联合类型any会导致this指向约束失效,当response是个函数时,在这个函数中调用this.res时,会报res不存在于MockMethod类型中 建议取消any的联合类型