mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-06-28 14:20:12 +00:00
correct typings for twit
This commit is contained in:
21
types/twit/index.d.ts
vendored
21
types/twit/index.d.ts
vendored
@@ -1,6 +1,7 @@
|
||||
// Type definitions for twit 2.2
|
||||
// Project: https://github.com/ttezel/twit
|
||||
// Definitions by: Volox <https://github.com/Volox>
|
||||
// lostfictions <https://github.com/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
|
||||
|
||||
@@ -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)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user