From 25005e29e97284e3a3a0901b53c2767f5d4ca6d7 Mon Sep 17 00:00:00 2001 From: Alec Mev Date: Sun, 30 Jun 2024 22:19:12 +0100 Subject: [PATCH] Fix #4712 TypeScript emits InstrumentationNodeModuleDefinition with " | undefined" for some reason, making it incompatible with InstrumentationModuleDefinition under exactOptionalPropertyTypes. --- .../packages/opentelemetry-instrumentation/src/types.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/experimental/packages/opentelemetry-instrumentation/src/types.ts b/experimental/packages/opentelemetry-instrumentation/src/types.ts index 2fa567ff012..b58054ac0df 100644 --- a/experimental/packages/opentelemetry-instrumentation/src/types.ts +++ b/experimental/packages/opentelemetry-instrumentation/src/types.ts @@ -136,11 +136,15 @@ export interface InstrumentationModuleDefinition { /** Method to patch the instrumentation */ // eslint-disable-next-line @typescript-eslint/no-explicit-any - patch?: (moduleExports: any, moduleVersion?: string) => any; + patch?: + | ((moduleExports: any, moduleVersion?: string | undefined) => any) + | undefined; /** Method to unpatch the instrumentation */ // eslint-disable-next-line @typescript-eslint/no-explicit-any - unpatch?: (moduleExports: any, moduleVersion?: string) => void; + unpatch?: + | ((moduleExports: any, moduleVersion?: string | undefined) => void) + | undefined; } /**