From 5f62c5b95edb20de583ac67dcb104cb9e21345a7 Mon Sep 17 00:00:00 2001
From: Alec Mev <alec@mev.earth>
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;
 }
 
 /**