Skip to content

Commit 30878c4

Browse files
committed
chore: Type InteractionHistory.on correctly
1 parent 075dd0c commit 30878c4

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

packages/navie/src/interaction-history.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
/* eslint-disable @typescript-eslint/no-unsafe-declaration-merging */
12
import EventEmitter from 'events';
2-
import * as path from 'path';
33
import InteractionState from './interaction-state';
44
import { ContextV2 } from './context';
55
import { PROMPTS, PromptType } from './prompt';
@@ -283,11 +283,7 @@ export class TechStackEvent extends InteractionEvent {
283283
}
284284
}
285285

286-
export interface InteractionHistoryEvents {
287-
on(event: 'event', listener: (event: InteractionEvent) => void): void;
288-
}
289-
290-
export default class InteractionHistory extends EventEmitter implements InteractionHistoryEvents {
286+
class InteractionHistory extends EventEmitter {
291287
public readonly events: InteractionEvent[] = [];
292288

293289
// eslint-disable-next-line class-methods-use-this
@@ -333,3 +329,10 @@ export default class InteractionHistory extends EventEmitter implements Interact
333329
return state;
334330
}
335331
}
332+
333+
interface InteractionHistory {
334+
on(event: 'event', listener: (event: InteractionEvent) => void): this;
335+
on(event: string, listener: (...args: unknown[]) => void): this;
336+
}
337+
338+
export default InteractionHistory;

packages/navie/src/navie.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import InteractionHistory, {
88
AgentSelectionEvent,
99
ClassificationEvent,
1010
InteractionEvent,
11-
InteractionHistoryEvents,
1211
} from './interaction-history';
1312
import { ContextV2 } from './context';
1413
import { UserContext } from './user-context';
@@ -49,7 +48,7 @@ export interface ClientRequest {
4948
prompt?: string;
5049
}
5150

52-
export interface INavie extends InteractionHistoryEvents {
51+
export interface INavie {
5352
on(event: 'event', listener: (event: InteractionEvent) => void): void;
5453

5554
on(event: 'agent', listener: (agent: string) => void): void;

0 commit comments

Comments
 (0)