From 07e06c5958cadc63c3a0335736d6328efaee3d30 Mon Sep 17 00:00:00 2001 From: Ali Sabzevari Date: Fri, 3 Sep 2021 16:38:45 +0200 Subject: [PATCH] chore(instrumentation-fetch): fix lint warnings --- .../src/fetch.ts | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/packages/opentelemetry-instrumentation-fetch/src/fetch.ts b/packages/opentelemetry-instrumentation-fetch/src/fetch.ts index 01ff72cb2f..29d52b0943 100644 --- a/packages/opentelemetry-instrumentation-fetch/src/fetch.ts +++ b/packages/opentelemetry-instrumentation-fetch/src/fetch.ts @@ -84,7 +84,7 @@ export class FetchInstrumentation extends InstrumentationBase< ); } - init() {} + init(): void {} private _getConfig(): FetchInstrumentationConfig { return this._config; @@ -326,11 +326,9 @@ export class FetchInstrumentation extends InstrumentationBase< } function onSuccess( span: api.Span, - resolve: ( - value?: Response | PromiseLike | undefined - ) => void, + resolve: (value: Response | PromiseLike) => void, response: Response - ) { + ): void { try { const resClone = response.clone(); const body = resClone.body; @@ -381,7 +379,7 @@ export class FetchInstrumentation extends InstrumentationBase< return original .apply(this, options instanceof Request ? [options] : [url, options]) .then( - (onSuccess as any).bind(this, createdSpan, resolve), + onSuccess.bind(this, createdSpan, resolve), onError.bind(this, createdSpan, reject) ); } @@ -447,7 +445,7 @@ export class FetchInstrumentation extends InstrumentationBase< /** * implements enable function */ - override enable() { + override enable(): void { if (isWrapped(window.fetch)) { this._unwrap(window, 'fetch'); this._diag.debug('removing previous patch for constructor'); @@ -458,7 +456,7 @@ export class FetchInstrumentation extends InstrumentationBase< /** * implements unpatch function */ - override disable() { + override disable(): void { this._unwrap(window, 'fetch'); this._usedResources = new WeakSet(); }