Skip to content

Commit

Permalink
Fixing TS errors
Browse files Browse the repository at this point in the history
  • Loading branch information
KrysKruk authored and njoy89 committed Mar 13, 2024
1 parent dd6ad32 commit d45b5f6
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
5 changes: 3 additions & 2 deletions api/src/api/diag.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
DiagLogger,
DiagLoggerApi,
DiagLogLevel,
DiagLoggerOptions,
} from '../diag/types';
import {
getGlobal,
Expand Down Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export abstract class BatchSpanProcessorBase<T extends BufferConfig>

private _isExporting = false;
private _finishedSpans: ReadableSpan[] = [];
private _timer: NodeJS.Timeout | undefined;
private _timer: number | undefined;
private _shutdownOnce: BindOnceFuture<void>;
private _droppedSpansCount: number = 0;

Expand Down Expand Up @@ -150,7 +150,7 @@ export abstract class BatchSpanProcessorBase<T extends BufferConfig>
* */
private _flushAll(): Promise<void> {
return new Promise((resolve, reject) => {
const promises = [];
const promises: Promise<void>[] = [];
// calculate number of batches
const count = Math.ceil(
this._finishedSpans.length / this._maxExportBatchSize
Expand All @@ -172,7 +172,7 @@ export abstract class BatchSpanProcessorBase<T extends BufferConfig>
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);
Expand Down Expand Up @@ -238,7 +238,7 @@ export abstract class BatchSpanProcessorBase<T extends BufferConfig>
return flush();
}
if (this._timer !== undefined) return;
this._timer = setTimeout(() => flush(), this._scheduledDelayMillis);
this._timer = window.setTimeout(() => flush(), this._scheduledDelayMillis);
unrefTimer(this._timer);

Check failure on line 242 in packages/opentelemetry-sdk-trace-base/src/export/BatchSpanProcessorBase.ts

View workflow job for this annotation

GitHub Actions / webworker-tests

Argument of type 'number' is not assignable to parameter of type 'Timer'.

Check failure on line 242 in packages/opentelemetry-sdk-trace-base/src/export/BatchSpanProcessorBase.ts

View workflow job for this annotation

GitHub Actions / webworker-tests

Argument of type 'number' is not assignable to parameter of type 'Timer'.

Check failure on line 242 in packages/opentelemetry-sdk-trace-base/src/export/BatchSpanProcessorBase.ts

View workflow job for this annotation

GitHub Actions / webworker-tests

Argument of type 'number' is not assignable to parameter of type 'Timer'.

Check failure on line 242 in packages/opentelemetry-sdk-trace-base/src/export/BatchSpanProcessorBase.ts

View workflow job for this annotation

GitHub Actions / node-tests (16)

Argument of type 'number' is not assignable to parameter of type 'Timer'.

Check failure on line 242 in packages/opentelemetry-sdk-trace-base/src/export/BatchSpanProcessorBase.ts

View workflow job for this annotation

GitHub Actions / node-tests (16)

Argument of type 'number' is not assignable to parameter of type 'Timer'.

Check failure on line 242 in packages/opentelemetry-sdk-trace-base/src/export/BatchSpanProcessorBase.ts

View workflow job for this annotation

GitHub Actions / node-tests (16)

Argument of type 'number' is not assignable to parameter of type 'Timer'.

Check failure on line 242 in packages/opentelemetry-sdk-trace-base/src/export/BatchSpanProcessorBase.ts

View workflow job for this annotation

GitHub Actions / node-tests (20)

Argument of type 'number' is not assignable to parameter of type 'Timer'.

Check failure on line 242 in packages/opentelemetry-sdk-trace-base/src/export/BatchSpanProcessorBase.ts

View workflow job for this annotation

GitHub Actions / node-tests (20)

Argument of type 'number' is not assignable to parameter of type 'Timer'.

Check failure on line 242 in packages/opentelemetry-sdk-trace-base/src/export/BatchSpanProcessorBase.ts

View workflow job for this annotation

GitHub Actions / node-tests (20)

Argument of type 'number' is not assignable to parameter of type 'Timer'.

Check failure on line 242 in packages/opentelemetry-sdk-trace-base/src/export/BatchSpanProcessorBase.ts

View workflow job for this annotation

GitHub Actions / browser-tests

Argument of type 'number' is not assignable to parameter of type 'Timer'.

Check failure on line 242 in packages/opentelemetry-sdk-trace-base/src/export/BatchSpanProcessorBase.ts

View workflow job for this annotation

GitHub Actions / browser-tests

Argument of type 'number' is not assignable to parameter of type 'Timer'.

Check failure on line 242 in packages/opentelemetry-sdk-trace-base/src/export/BatchSpanProcessorBase.ts

View workflow job for this annotation

GitHub Actions / browser-tests

Argument of type 'number' is not assignable to parameter of type 'Timer'.

Check failure on line 242 in packages/opentelemetry-sdk-trace-base/src/export/BatchSpanProcessorBase.ts

View workflow job for this annotation

GitHub Actions / node-tests (18)

Argument of type 'number' is not assignable to parameter of type 'Timer'.

Check failure on line 242 in packages/opentelemetry-sdk-trace-base/src/export/BatchSpanProcessorBase.ts

View workflow job for this annotation

GitHub Actions / node-tests (18)

Argument of type 'number' is not assignable to parameter of type 'Timer'.

Check failure on line 242 in packages/opentelemetry-sdk-trace-base/src/export/BatchSpanProcessorBase.ts

View workflow job for this annotation

GitHub Actions / node-tests (18)

Argument of type 'number' is not assignable to parameter of type 'Timer'.

Check failure on line 242 in packages/opentelemetry-sdk-trace-base/src/export/BatchSpanProcessorBase.ts

View workflow job for this annotation

GitHub Actions / node-tests (14)

Argument of type 'number' is not assignable to parameter of type 'Timer'.

Check failure on line 242 in packages/opentelemetry-sdk-trace-base/src/export/BatchSpanProcessorBase.ts

View workflow job for this annotation

GitHub Actions / node-tests (14)

Argument of type 'number' is not assignable to parameter of type 'Timer'.

Check failure on line 242 in packages/opentelemetry-sdk-trace-base/src/export/BatchSpanProcessorBase.ts

View workflow job for this annotation

GitHub Actions / node-tests (14)

Argument of type 'number' is not assignable to parameter of type 'Timer'.

Check failure on line 242 in packages/opentelemetry-sdk-trace-base/src/export/BatchSpanProcessorBase.ts

View workflow job for this annotation

GitHub Actions / node-windows-tests

Argument of type 'number' is not assignable to parameter of type 'Timer'.

Check failure on line 242 in packages/opentelemetry-sdk-trace-base/src/export/BatchSpanProcessorBase.ts

View workflow job for this annotation

GitHub Actions / node-windows-tests

Argument of type 'number' is not assignable to parameter of type 'Timer'.

Check failure on line 242 in packages/opentelemetry-sdk-trace-base/src/export/BatchSpanProcessorBase.ts

View workflow job for this annotation

GitHub Actions / node-windows-tests

Argument of type 'number' is not assignable to parameter of type 'Timer'.
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export type PeriodicExportingMetricReaderOptions = {
* the configured {@link PushMetricExporter}
*/
export class PeriodicExportingMetricReader extends MetricReader {
private _interval?: ReturnType<typeof setInterval>;
private _interval?: number;
private _exporter: PushMetricExporter;
private readonly _exportInterval: number;
private readonly _exportTimeout: number;
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk-metrics/src/state/MetricStorageRegistry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit d45b5f6

Please sign in to comment.