mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-06-02 19:43:20 +08:00
Fixed incorrect type for Twit.stream (#20173)
The Twit docs [specifically says](https://github.com/ttezel/twit#using-the-streaming-api) that the `stream` function returns an `EventEmitter`. It also says that the `EventEmitter` has [two methods - `start()` and `stop()`](https://github.com/ttezel/twit#streamstop) to start and stop the Twitter stream. The return type was incorrectly specified as a `NodeJS.ReadableStream`. This fixes that.
This commit is contained in:
committed by
Ryan Cavanaugh
parent
0b21b7dd63
commit
6a96efd84a
7
types/twit/index.d.ts
vendored
7
types/twit/index.d.ts
vendored
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user