Skip to content

Commit a3cbb3e

Browse files
committed
please use types and don't make me import enums
1 parent 6634e40 commit a3cbb3e

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

src/packages/ListenLiveClient.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { AbstractLiveClient } from "./AbstractLiveClient";
22
import { LiveTranscriptionEvents } from "../lib/enums";
3-
import type { LiveSchema, LiveConfigOptions, DeepgramClientOptions } from "../lib/types";
4-
import { DeepgramError } from "../lib/errors";
3+
import type { LiveSchema, LiveConfigOptions, DeepgramClientOptions, LiveTranscriptionEvent, LiveMetadataEvent, UtteranceEndEvent, SpeechStartedEvent } from "../lib/types";
4+
import { DeepgramApiError, DeepgramError } from "../lib/errors";
55

66
/**
77
* The `ListenLiveClient` class extends the `AbstractLiveClient` class and provides functionality for setting up and managing a WebSocket connection for live transcription.
@@ -147,4 +147,17 @@ export class ListenLiveClient extends AbstractLiveClient {
147147
}
148148
}
149149

150+
// eslint-disable-next-line
151+
export interface ListenLiveClient {
152+
on(eventName: `${LiveTranscriptionEvents.Transcript}`, listener: (data: LiveTranscriptionEvent) => void): this
153+
on(eventName: `${LiveTranscriptionEvents.Metadata}`, listener: (data: LiveMetadataEvent) => void): this
154+
on(eventName: `${LiveTranscriptionEvents.UtteranceEnd}`, listener: (data: UtteranceEndEvent) => void): this
155+
on(eventName: `${LiveTranscriptionEvents.SpeechStarted}`, listener: (data: SpeechStartedEvent) => void): this
156+
on(eventName: `${LiveTranscriptionEvents.Error}`, listener: (data: DeepgramApiError) => void): this
157+
on(eventName: `${LiveTranscriptionEvents.Close}`, listener: () => void): this
158+
on(eventName: `${LiveTranscriptionEvents.Open}`, listener: () => void): this
159+
on(eventName: `${LiveTranscriptionEvents.Unhandled}`, listener: (data: unknown) => void): this
160+
}
161+
162+
150163
export { ListenLiveClient as LiveClient };

0 commit comments

Comments
 (0)