diff --git a/api/src/api/diag.ts b/api/src/api/diag.ts index a873c2dc373..c83f59ac10c 100644 --- a/api/src/api/diag.ts +++ b/api/src/api/diag.ts @@ -22,6 +22,7 @@ import { DiagLogger, DiagLoggerApi, DiagLogLevel, + DiagLoggerOptions, } from '../diag/types'; import { getGlobal, @@ -67,8 +68,8 @@ export class DiagAPI implements DiagLogger, DiagLoggerApi { // DiagAPI specific functions const setLogger: DiagLoggerApi['setLogger'] = ( - logger, - optionsOrLogLevel = { logLevel: DiagLogLevel.INFO } + logger: DiagLogger, + optionsOrLogLevel: DiagLoggerOptions | DiagLogLevel = { logLevel: DiagLogLevel.INFO } ) => { if (logger === self) { // There isn't much we can do here. diff --git a/experimental/packages/opentelemetry-instrumentation/src/platform/node/RequireInTheMiddleSingleton.ts b/experimental/packages/opentelemetry-instrumentation/src/platform/node/RequireInTheMiddleSingleton.ts index ca74699e90e..c01f1ece146 100644 --- a/experimental/packages/opentelemetry-instrumentation/src/platform/node/RequireInTheMiddleSingleton.ts +++ b/experimental/packages/opentelemetry-instrumentation/src/platform/node/RequireInTheMiddleSingleton.ts @@ -38,7 +38,6 @@ const isMocha = [ 'describe', 'it', ].every(fn => { - // @ts-expect-error TS7053: Element implicitly has an 'any' type return typeof global[fn] === 'function'; }); diff --git a/packages/opentelemetry-sdk-trace-base/src/export/BatchSpanProcessorBase.ts b/packages/opentelemetry-sdk-trace-base/src/export/BatchSpanProcessorBase.ts index f069aac0c7d..1d5173f898e 100644 --- a/packages/opentelemetry-sdk-trace-base/src/export/BatchSpanProcessorBase.ts +++ b/packages/opentelemetry-sdk-trace-base/src/export/BatchSpanProcessorBase.ts @@ -43,7 +43,7 @@ export abstract class BatchSpanProcessorBase private _isExporting = false; private _finishedSpans: ReadableSpan[] = []; - private _timer: NodeJS.Timeout | undefined; + private _timer: number | undefined; private _shutdownOnce: BindOnceFuture; private _droppedSpansCount: number = 0; @@ -150,7 +150,7 @@ export abstract class BatchSpanProcessorBase * */ private _flushAll(): Promise { return new Promise((resolve, reject) => { - const promises = []; + const promises: Promise[] = []; // calculate number of batches const count = Math.ceil( this._finishedSpans.length / this._maxExportBatchSize @@ -172,7 +172,7 @@ export abstract class BatchSpanProcessorBase return Promise.resolve(); } return new Promise((resolve, reject) => { - const timer = setTimeout(() => { + const timer = window.setTimeout(() => { // don't wait anymore for export, this way the next batch can start reject(new Error('Timeout')); }, this._exportTimeoutMillis); @@ -238,7 +238,7 @@ export abstract class BatchSpanProcessorBase return flush(); } if (this._timer !== undefined) return; - this._timer = setTimeout(() => flush(), this._scheduledDelayMillis); + this._timer = window.setTimeout(() => flush(), this._scheduledDelayMillis); unrefTimer(this._timer); } diff --git a/packages/sdk-metrics/src/export/PeriodicExportingMetricReader.ts b/packages/sdk-metrics/src/export/PeriodicExportingMetricReader.ts index 5ecafff6822..a587427fc3e 100644 --- a/packages/sdk-metrics/src/export/PeriodicExportingMetricReader.ts +++ b/packages/sdk-metrics/src/export/PeriodicExportingMetricReader.ts @@ -55,7 +55,7 @@ export type PeriodicExportingMetricReaderOptions = { * the configured {@link PushMetricExporter} */ export class PeriodicExportingMetricReader extends MetricReader { - private _interval?: ReturnType; + private _interval?: number; private _exporter: PushMetricExporter; private readonly _exportInterval: number; private readonly _exportTimeout: number; @@ -150,7 +150,7 @@ export class PeriodicExportingMetricReader extends MetricReader { protected override onInitialized(): void { // start running the interval as soon as this reader is initialized and keep handle for shutdown. - this._interval = setInterval(() => { + this._interval = window.setInterval(() => { // this._runOnce never rejects. Using void operator to suppress @typescript-eslint/no-floating-promises. void this._runOnce(); }, this._exportInterval); diff --git a/packages/sdk-metrics/src/state/MetricStorageRegistry.ts b/packages/sdk-metrics/src/state/MetricStorageRegistry.ts index c44ad8b5f86..957f941d68d 100644 --- a/packages/sdk-metrics/src/state/MetricStorageRegistry.ts +++ b/packages/sdk-metrics/src/state/MetricStorageRegistry.ts @@ -122,7 +122,7 @@ export class MetricStorageRegistry { expectedDescriptor: InstrumentDescriptor, existingStorages: MetricStorage[] ): T | null { - let compatibleStorage = null; + let compatibleStorage: T | null = null; for (const existingStorage of existingStorages) { const existingDescriptor = existingStorage.getInstrumentDescriptor();