diff --git a/src/interceptors/ClientRequest/agents.ts b/src/interceptors/ClientRequest/agents.ts index 5436f94c..e5f95a82 100644 --- a/src/interceptors/ClientRequest/agents.ts +++ b/src/interceptors/ClientRequest/agents.ts @@ -31,7 +31,7 @@ export class MockAgent extends http.Agent { this.onResponse = options.onResponse } - public createConnection(options: any, callback: any) { + public createConnection(options: any, callback: any): net.Socket { const createConnection = (this.customAgent instanceof http.Agent && this.customAgent.createConnection) || @@ -64,7 +64,7 @@ export class MockHttpsAgent extends https.Agent { this.onResponse = options.onResponse } - public createConnection(options: any, callback: any) { + public createConnection(options: any, callback: any): net.Socket { const createConnection = (this.customAgent instanceof https.Agent && this.customAgent.createConnection) || diff --git a/src/interceptors/XMLHttpRequest/utils/createEvent.ts b/src/interceptors/XMLHttpRequest/utils/createEvent.ts index bc35ffd3..be87b369 100644 --- a/src/interceptors/XMLHttpRequest/utils/createEvent.ts +++ b/src/interceptors/XMLHttpRequest/utils/createEvent.ts @@ -7,7 +7,7 @@ export function createEvent( target: XMLHttpRequest | XMLHttpRequestUpload, type: string, init?: ProgressEventInit -): EventPolyfill { +): EventPolyfill | ProgressEvent { const progressEvents = [ 'error', 'progress',