Skip to content

Commit c01ffd8

Browse files
committed
refactor(sdk-trace-node): fix eslint warning
``` /home/runner/work/opentelemetry-js/opentelemetry-js/packages/opentelemetry-sdk-trace-node/test/registration.test.ts 30:61 warning Don't use `Function` as a type @typescript-eslint/ban-types ``` Here we are looking for a `AnyConstructor` type, and `Function` is a close enough approximation that exists in the standard library. The potential foot gun of _calling_ the function resulting in an `any` value still exists, but this is a small function used in tests only, so that's probably acceptable. Ref open-telemetry#5365
1 parent 199fd8d commit c01ffd8

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

packages/opentelemetry-sdk-trace-node/test/registration.test.ts

+6-3
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,13 @@ import { AsyncLocalStorageContextManager } from '@opentelemetry/context-async-ho
2727
import { CompositePropagator } from '@opentelemetry/core';
2828
import { NodeTracerProvider } from '../src';
2929

30-
const assertInstanceOf = (actual: object, ExpectedInstance: Function) => {
30+
// Here we are looking for a `AnyConstructor` type, and `Function` is a close
31+
// enough approximation that exists in the standard library.
32+
// eslint-disable-next-line @typescript-eslint/ban-types
33+
const assertInstanceOf = (actual: object, ExpectedConstructor: Function) => {
3134
assert.ok(
32-
actual instanceof ExpectedInstance,
33-
`Expected ${inspect(actual)} to be instance of ${ExpectedInstance.name}`
35+
actual instanceof ExpectedConstructor,
36+
`Expected ${inspect(actual)} to be instance of ${ExpectedConstructor.name}`
3437
);
3538
};
3639

0 commit comments

Comments
 (0)