Skip to content

Commit 926a31c

Browse files
committed
Add type ignores for Reflect instead
1 parent e1c0f19 commit 926a31c

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

packages/nestjs/src/decorators.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import 'reflect-metadata';
21
import type { MonitorConfig } from '@sentry/core';
32
import { captureException, isThenable } from '@sentry/core';
43
import * as Sentry from '@sentry/node';
@@ -111,10 +110,18 @@ function copyFunctionNameAndMetadata({
111110
});
112111

113112
// copy metadata
113+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
114+
// @ts-ignore - reflect-metadata of nestjs adds these methods to Reflect
114115
if (typeof Reflect !== 'undefined' && typeof Reflect.getMetadataKeys === 'function') {
116+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
117+
// @ts-ignore - reflect-metadata of nestjs adds these methods to Reflect
115118
const originalMetaData = Reflect.getMetadataKeys(originalMethod);
116119
for (const key of originalMetaData) {
120+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
121+
// @ts-ignore - reflect-metadata of nestjs adds these methods to Reflect
117122
const value = Reflect.getMetadata(key, originalMethod);
123+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
124+
// @ts-ignore - reflect-metadata of nestjs adds these methods to Reflect
118125
Reflect.defineMetadata(key, value, descriptor.value);
119126
}
120127
}

packages/nestjs/src/integrations/sentry-nest-event-instrumentation.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import 'reflect-metadata';
21
import type { InstrumentationConfig } from '@opentelemetry/instrumentation';
32
import {
43
InstrumentationBase,
@@ -84,7 +83,11 @@ export class SentryNestEventInstrumentation extends InstrumentationBase {
8483
descriptor.value = async function (...args: unknown[]) {
8584
// When multiple @OnEvent decorators are used on a single method, we need to get all event names
8685
// from the reflector metadata as there is no information during execution which event triggered it
86+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
87+
// @ts-ignore - reflect-metadata of nestjs adds these methods to Reflect
8788
if (Reflect.getMetadataKeys(descriptor.value).includes('EVENT_LISTENER_METADATA')) {
89+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
90+
// @ts-ignore - reflect-metadata of nestjs adds these methods to Reflect
8891
const eventData = Reflect.getMetadata('EVENT_LISTENER_METADATA', descriptor.value);
8992
if (Array.isArray(eventData)) {
9093
eventName = eventData

0 commit comments

Comments
 (0)