From 23a0d44b11dec59113bdfe5d8573cf9350a2c15b Mon Sep 17 00:00:00 2001
From: Alex Yang <himself65@outlook.com>
Date: Sat, 6 Apr 2024 17:09:39 -0500
Subject: [PATCH] fix: jsr disallow global type

---
 .../core/src/callbacks/CallbackManager.ts     | 27 +++++++++----------
 packages/core/src/llm/types.ts                |  7 -----
 2 files changed, 13 insertions(+), 21 deletions(-)

diff --git a/packages/core/src/callbacks/CallbackManager.ts b/packages/core/src/callbacks/CallbackManager.ts
index 71e0c3149..f79f972fb 100644
--- a/packages/core/src/callbacks/CallbackManager.ts
+++ b/packages/core/src/callbacks/CallbackManager.ts
@@ -5,6 +5,7 @@ import {
   EventCaller,
   getEventCaller,
 } from "../internal/context/EventCaller.js";
+import type { LLMEndEvent, LLMStartEvent } from "../llm/types.js";
 
 export class LlamaIndexCustomEvent<T = any> extends CustomEvent<T> {
   reason: EventCaller | null;
@@ -30,21 +31,19 @@ export class LlamaIndexCustomEvent<T = any> extends CustomEvent<T> {
 }
 
 /**
- * This type is used to define the event maps for the Llamaindex package.
+ * This type is used to define the event maps.
  */
-export interface LlamaIndexEventMaps {}
-
-declare module "llamaindex" {
-  interface LlamaIndexEventMaps {
-    /**
-     * @deprecated
-     */
-    retrieve: CustomEvent<RetrievalCallbackResponse>;
-    /**
-     * @deprecated
-     */
-    stream: CustomEvent<StreamCallbackResponse>;
-  }
+export interface LlamaIndexEventMaps {
+  /**
+   * @deprecated
+   */
+  retrieve: CustomEvent<RetrievalCallbackResponse>;
+  /**
+   * @deprecated
+   */
+  stream: CustomEvent<StreamCallbackResponse>;
+  "llm-start": LLMStartEvent;
+  "llm-end": LLMEndEvent;
 }
 
 //#region @deprecated remove in the next major version
diff --git a/packages/core/src/llm/types.ts b/packages/core/src/llm/types.ts
index f8ac3f77a..626183b11 100644
--- a/packages/core/src/llm/types.ts
+++ b/packages/core/src/llm/types.ts
@@ -21,13 +21,6 @@ export type LLMEndEvent = LLMBaseEvent<
   }
 >;
 
-declare module "llamaindex" {
-  interface LlamaIndexEventMaps {
-    "llm-start": LLMStartEvent;
-    "llm-end": LLMEndEvent;
-  }
-}
-
 /**
  * @internal
  */
-- 
GitLab