diff --git a/types/twit/index.d.ts b/types/twit/index.d.ts index 337a51b476..91d683833e 100644 --- a/types/twit/index.d.ts +++ b/types/twit/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for twit 2.2 // Project: https://github.com/ttezel/twit // Definitions by: Volox +// lostfictions // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -208,12 +209,22 @@ declare module 'twit' { query?: string, max_id_str?: string } + + export interface Errors { + errors: { + code: number + message: string + }[] + } + + export interface SearchResults { + statuses: Twitter.Status[], + search_metadata: Twitter.Metadata, + } } - export interface Response { - statuses: Twitter.Status[], - search_metadata: Twitter.Metadata, - } + export type Response = object + interface MediaParam { file_path: string } @@ -250,7 +261,7 @@ declare module 'twit' { } export interface PromiseResponse { data: Response, - responde: IncomingMessage, + resp: IncomingMessage, } export interface Callback { (err: Error, result: Response, response: IncomingMessage): void diff --git a/types/twit/twit-tests.ts b/types/twit/twit-tests.ts index e346771f35..c74f5d6855 100644 --- a/types/twit/twit-tests.ts +++ b/types/twit/twit-tests.ts @@ -5,3 +5,9 @@ const t = new Twit( { consumer_secret: '', app_only_auth: true, } ); + +t.post('statuses/update', { status: 'hello!' }).then(res => { + const status = res.data as Twit.Twitter.Status + console.log(status.id_str) + console.log(res.resp.statusCode) +})