diff --git a/types/twit/index.d.ts b/types/twit/index.d.ts index c8687cc6fb..63ca3b747d 100644 --- a/types/twit/index.d.ts +++ b/types/twit/index.d.ts @@ -8,6 +8,7 @@ declare module 'twit' { import { IncomingMessage } from 'http'; + import { EventEmitter } from 'events'; namespace Twit { export type StreamEndpoint = 'statuses/filter' | 'statuses/sample' | 'statuses/firehose' | 'user' | 'site'; @@ -264,6 +265,10 @@ declare module 'twit' { timeout_ms?: number, trusted_cert_fingerprints?: string[], } + export interface Stream extends EventEmitter { + start(): void; + stop(): void; + } } class Twit { @@ -304,7 +309,7 @@ declare module 'twit' { /** * @see https://github.com/ttezel/twit#tstreampath-params */ - stream(path: Twit.StreamEndpoint, params?: Twit.Params): NodeJS.ReadableStream; + stream(path: Twit.StreamEndpoint, params?: Twit.Params): Twit.Stream; } export = Twit;